/* Variables CSS pour la cohérence des couleurs */
:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #64748b;
    --success-color: #4CAF50;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    --transition-normal: all 0.3s ease;
}

/* Reset CSS */
#edu-chat-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Arabic', sans-serif;
}

/* Exemple de page (à supprimer lors de l'intégration) */
.content-example {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    text-align: center;
}

/* Container principal du chat */
#edu-chat-container {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Pour RTL, on place à gauche */
    z-index: 9999;
    direction: rtl;
    text-align: right;
    font-size: 16px;
}

/* Bulle de chat flottante */
#edu-chat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
    position: relative;
}

#edu-chat-bubble:hover {
    transform: scale(1.05);
}

.edu-chat-bubble-icon {
    font-size: 24px;
    color: white;
}

/* Animation de pulsation pour la bulle */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.edu-chat-pulse {
    animation: pulse 2s infinite;
}

/* Fenêtre de chat */
#edu-chat-window {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 350px;
    height: 500px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    z-index: 9998;
}

/* État caché de la fenêtre */
.edu-chat-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* En-tête de la fenêtre de chat */
.edu-chat-header {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.edu-chat-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.edu-chat-icon {
    margin-left: 8px;
    font-size: 18px;
}

.edu-chat-controls {
    display: flex;
    gap: 8px;
}

.edu-chat-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition-normal);
}

.edu-chat-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Corps de la fenêtre de chat */
.edu-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 48px);
}

/* Zone des messages */
.edu-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #f9fafb;
}

/* Message de bienvenue */
.edu-chat-welcome {
    background-color: rgba(76, 175, 80, 0.1);
    border-right: 3px solid var(--primary-color);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.edu-chat-welcome h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 16px;
}

.edu-chat-welcome p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Messages */
.edu-chat-message {
    margin-bottom: 16px;
    max-width: 85%;
    word-wrap: break-word;
}

.edu-chat-message-user {
    margin-left: auto;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 var(--radius-lg);
    padding: 10px 14px;
}

.edu-chat-message-bot {
    margin-right: auto;
    background-color: white;
    color: var(--text-primary);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.edu-chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: left;
}

.edu-chat-message-user .edu-chat-message-time {
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

/* Zone de saisie */
.edu-chat-input-container {
    display: flex;
    padding: 12px;
    background-color: white;
    border-top: 1px solid var(--border-color);
}

#edu-chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: var(--transition-normal);
    direction: rtl;
}

#edu-chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

#edu-chat-send {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    margin-right: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

#edu-chat-send:hover {
    background-color: var(--primary-hover);
}

.edu-send-icon {
    transform: rotate(180deg); /* Pour RTL */
}

/* Animation de chargement */
.edu-chat-loading {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background-color: white;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-right: auto;
    margin-bottom: 16px;
    max-width: 60px;
}

.edu-chat-loading-dots {
    display: flex;
}

.edu-chat-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin: 0 2px;
    opacity: 0.6;
}

.edu-chat-loading-dot:nth-child(1) {
    animation: dot-flashing 1s infinite alternate 0s;
}

.edu-chat-loading-dot:nth-child(2) {
    animation: dot-flashing 1s infinite alternate 0.3s;
}

.edu-chat-loading-dot:nth-child(3) {
    animation: dot-flashing 1s infinite alternate 0.6s;
}

@keyframes dot-flashing {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Responsive design */
@media (max-width: 480px) {
    #edu-chat-window {
        width: calc(100% - 40px);
        height: 60vh;
        bottom: 80px;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0f172a;
        --surface-color: #1e293b;
        --border-color: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
    }
    
    .edu-chat-messages {
        background-color: #1a2234;
    }
    
    .edu-chat-welcome {
        background-color: rgba(76, 175, 80, 0.15);
    }
    
    .edu-chat-message-bot {
        background-color: #2a3649;
        border-color: #334155;
    }
    
    #edu-chat-input {
        background-color: #2a3649;
        color: var(--text-primary);
        border-color: #334155;
    }
    
    .edu-chat-input-container {
        background-color: #1e293b;
    }
}

