/* ---------------------------------------------------
   BASE (shared styles)
--------------------------------------------------- */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
}

.ai-chat-actions button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

.ai-chat-actions button:hover {
    opacity: 0.8;
}

.ai-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: scroll;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;

    -ms-overflow-style: none;
    scrollbar-width: none;
}

.ai-chat-messages::-webkit-scrollbar {
    display: none;
}

.ai-message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message.system .message-avatar,
.ai-message.assistant .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message.user .message-avatar {
    background: #48c78e;
    color: white;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
}

.ai-message.user .message-content {
    background: #48c78e;
    color: white;
}

.message-content code {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.ai-chat-input {
    padding: 12px 16px;
    border-top: 1px solid;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    margin-top: 8px;
}

.ai-chat-container.collapsed .ai-chat-model-selector,
.ai-chat-container.collapsed .ai-chat-messages,
.ai-chat-container.collapsed .ai-chat-input {
    display: none;
}

/* ---------------------------------------------------
   ANIMATIONS
--------------------------------------------------- */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   LIGHT THEME
   Auto-applied if system prefers light
=================================================== */


    .ai-chat-container {
        background: white;
        color: #363636;
    }

    .ai-chat-model-selector {
        background: #f5f5f5;
        border-bottom: 1px solid #e0e0e0;
        color: #363636;
    }

    .message-content {
        background: #f5f5f5;
        color: #363636;
    }

    .message-content code {
        background: rgba(0,0,0,0.1);
        color: #222;
    }

    .ai-chat-input {
        background: white;
        border-color: #e0e0e0;
    }

    .ai-loading {
        color: #667eea;
    }


/* ===================================================
   DARK THEME
   Auto-applied if system prefers dark
=================================================== */
@media (prefers-color-scheme: dark) {

    .ai-chat-container {
        background: #1e1e1e;
        color: #e5e5e5;
    }

    .ai-chat-model-selector {
        background: #2b2b2b;
        border-bottom: 1px solid #3a3a3a;
        color: #fff;
    }

    .message-content {
        background: #2c2c2c;
        color: #e5e5e5;
    }

    .message-content code {
        background: rgba(255,255,255,0.15);
        color: #fff;
    }

    .ai-chat-input {
        background: #262626;
        border-color: #3a3a3a;
    }

    .ai-loading {
        color: #a29bfe;
    }

    .ai-message.user .message-content {
        background: #48c78e;
        color: white;
    }
}
