/* Mikai Chat Styles */
.mikai-chat {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    margin: 20px auto;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mikai-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
}

.mikai-messages {
    height: 350px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
    scroll-behavior: smooth;
}

.mikai-message {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.mikai-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mikai-user-bubble {
    background: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
    text-align: right;
}

.mikai-assistant-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    margin-right: auto;
    border-bottom-left-radius: 5px;
    text-align: left;
}

.mikai-error-bubble {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    margin-right: auto;
    border-radius: 18px;
}

.mikai-input-area {
    display: flex;
    gap: 10px;
}

.mikai-user-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.mikai-user-input:focus {
    border-color: #007bff;
}

.mikai-user-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.mikai-send-btn {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s;
    min-width: 80px;
}

.mikai-send-btn:hover:not(:disabled) {
    background: #0056b3;
}

.mikai-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Typing animation */
.mikai-typing .mikai-bubble {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 8px 16px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* HTML formatting inside bubbles */
.mikai-assistant-bubble h1,
.mikai-assistant-bubble h2,
.mikai-assistant-bubble h3,
.mikai-assistant-bubble h4,
.mikai-assistant-bubble h5,
.mikai-assistant-bubble h6 {
    margin: 0 0 8px 0;
    color: #2c3e50;
}

.mikai-assistant-bubble p {
    margin: 0 0 10px 0;
}

.mikai-assistant-bubble ul,
.mikai-assistant-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.mikai-assistant-bubble li {
    margin: 4px 0;
}

.mikai-assistant-bubble code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.mikai-assistant-bubble pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    font-family: monospace;
    font-size: 0.9em;
}

.mikai-assistant-bubble a {
    color: #007bff;
    text-decoration: none;
}

.mikai-assistant-bubble a:hover {
    text-decoration: underline;
}

.mikai-assistant-bubble strong {
    font-weight: 600;
}

.mikai-assistant-bubble em {
    font-style: italic;
}

/* Scrollbar styling */
.mikai-messages::-webkit-scrollbar {
    width: 6px;
}

.mikai-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mikai-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mikai-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 600px) {
    .mikai-chat {
        margin: 10px;
        padding: 15px;
    }
    
    .mikai-messages {
        height: 300px;
    }
    
    .mikai-bubble {
        max-width: 90%;
    }
}