/**
 * Styles pour le Café de l'Agora
 * PRIORITÉ : SIMPLICITÉ et LISIBILITÉ
 */

/* Bouton toggle "Café du Fil" - Desktop */
#agora-chat-toggle {
    display: inline-block;
    padding: 12px 20px;
    background: #F17E18;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin-bottom: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#agora-chat-toggle:hover {
    background: #D96D14;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

#agora-chat-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Bouton fermeture (mobile uniquement) */
#agora-chat-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

#agora-chat-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Description du Café (dans widget) */
.agora-chat-description {
    padding: 15px;
    background: #FFF8F0;
    border-left: 4px solid #F17E18;
    border-radius: 6px;
    margin-bottom: 15px;
}

.agora-chat-description p {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

.agora-chat-description p:last-child {
    margin-bottom: 0;
}

.agora-chat-description-note {
    font-size: 13px;
    color: #666;
}

/* Lien connexion */
.agora-chat-login-link {
    color: #F17E18;
    font-weight: 600;
    text-decoration: underline;
}

.agora-chat-login-link:hover {
    color: #D96D14;
}

/* Conteneur principal du widget */
.agora-chat-widget {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 100%;
}

/* État masqué par défaut */
.agora-chat-widget.agora-chat-hidden {
    display: none;
}

/* Titre du chat */
.agora-chat-title {
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    border-bottom: 2px solid #f0f0f0;
    font-size: 18px;
    font-weight: 600;
    color: #333333;
}

/* Conteneur des messages */
#agora-chat-messages {
    height: 400px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 15px;
    padding: 10px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

/* Message de chargement / vide */
.agora-chat-loading,
.agora-chat-empty {
    text-align: center;
    color: #888888;
    font-style: italic;
    padding: 20px;
    margin: 0;
}

/* Message individuel */
.agora-chat-message {
    margin-bottom: 12px;
    padding: 10px;
    background: #ffffff;
    border-radius: 6px;
    border-left: 3px solid #4a90e2;
}

.agora-chat-message:last-child {
    margin-bottom: 0;
}

/* Limitation : masquer messages au-delà des 2 premiers */
.agora-chat-messages.limited .agora-chat-message:nth-child(n+3) {
    display: none;
}

/* Bouton "Afficher plus" */
.agora-chat-show-more {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-top: 10px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    color: #4a90e2;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.agora-chat-show-more:hover {
    background: #e8e8e8;
    color: #357abd;
}

/* Message lecture seule */
.agora-chat-readonly-notice {
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    text-align: center;
    font-size: 13px;
    margin-bottom: 10px;
}

/* En-tête du message (nom + temps) */
.agora-chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

/* Nom d'utilisateur */
.agora-chat-user-name {
    font-weight: 600;
    color: #333333;
}

/* Horodatage */
.agora-chat-time {
    color: #888888;
    font-size: 11px;
}

/* Texte du message */
.agora-chat-message-text {
    color: #444444;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Zone de saisie */
.agora-chat-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

/* Champ de saisie */
#agora-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#agora-chat-input:focus {
    outline: none;
    border-color: #4a90e2;
}

#agora-chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Bouton d'envoi */
#agora-chat-send {
    padding: 10px 20px;
    background: #4a90e2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#agora-chat-send:hover {
    background: #357abd;
}

#agora-chat-send:active {
    background: #2868a8;
}

#agora-chat-send:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Message de statut */
#agora-chat-status {
    display: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}

/* Statut succès */
#agora-chat-status.agora-chat-status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Statut erreur */
#agora-chat-status.agora-chat-status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Message d'erreur (non connecté) */
.agora-chat-error {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    text-align: center;
}

/* Scrollbar personnalisée (navigateurs WebKit) */
#agora-chat-messages::-webkit-scrollbar {
    width: 8px;
}

#agora-chat-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

#agora-chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

#agora-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Responsive pour petits écrans */
@media (max-width: 768px) {
    /* Bouton flottant mobile */
    #agora-chat-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: auto;
        padding: 14px 18px;
        border-radius: 25px;
        font-size: 15px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        z-index: 9999;
        margin-bottom: 0;
    }

    /* Widget en mode mobile (plein écran) */
    .agora-chat-widget {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        border-radius: 0;
        z-index: 10000;
        overflow-y: auto;
    }

    /* Afficher bouton fermeture en mobile */
    #agora-chat-close {
        display: block;
    }

    /* Conteneur messages réduit sur mobile */
    #agora-chat-messages {
        height: calc(100vh - 350px);
        max-height: calc(100vh - 350px);
    }

    .agora-chat-input-wrapper {
        flex-direction: row;
        gap: 8px;
    }

    #agora-chat-send {
        width: auto;
        padding: 10px 16px;
    }

    /* Description en mobile */
    .agora-chat-description {
        font-size: 13px;
        margin-top: 50px;
    }
}
