/* ========================================
   STYLES COMPLÉMENTAIRES MESSAGERIE
   ======================================== */

/* Réafficher les entrées de navigation masquées globalement par hidden.css */
.navigation #nav-rapports,
.navigation #nav-audiobanque {
    display: inline-block;
}

/* Ajustement de la hauteur pour le chat */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: 520px; /* slightly taller for comfort */
    font-family: var(--font-secondary, 'Loos', 'Rajdhani', sans-serif);
}

/* Headings use the display font, body and UI use the secondary font */
.chat-header h1, .chat-header h2, .chat-header h3, .chat-header h4 {
    font-family: var(--font-main, 'Bruno Ace') !important;
}

.chat-interface, #chat-display, .msg-row, .contact-item, .encryption-status, .active-nav, #message-input, #send-btn {
    font-family: var(--font-secondary, 'Loos') !important;
}

.chat-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--grey);
    padding: 8px 10px;
    margin-bottom: 12px;
    justify-content: space-between;
    background: linear-gradient(90deg, var(--bg-soft), transparent);
}

.chat-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--brand-accent-2);
    letter-spacing: 0.6px;
    font-family: var(--font-main, 'Bruno Ace');
}

/* Active nav link style (used in HTML) */
.active-nav {
    background-color: var(--brand-accent);
    color: var(--brand-white) !important;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 700;
}

.encryption-status {
    font-size: 12px;
    background-color: var(--brand-accent);
    color: var(--brand-white);
    padding: 4px 8px;
    font-weight: 700;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--accent-soft);
}

/* Zone d'affichage des messages (surcharge légère de terminal-screen) */
#chat-display {
    flex: 1;
    background-color: var(--bg-soft);
    margin-bottom: 0;
    border-bottom: none;
    padding: 12px;
    overflow-y: auto;
    border-radius: 4px;
}

/* Styles des messages */
.msg-row {
    margin-bottom: 10px;
    font-family: var(--font-secondary, 'Loos', 'Courier New', monospace);
    font-size: 14px;
    line-height: 1.45;
    color: var(--brand-white);
}

.msg-time {
    color: var(--brand-muted);
    margin-right: 6px;
    font-size: 12px;
}

.msg-sender {
    color: var(--brand-accent-2);
    font-weight: 700;
}

.msg-content {
    color: var(--brand-white);
}

/* Distinction envoyeur/receveur */
.msg-row.sent .msg-sender {
    color: var(--brand-accent-2); /* sent messages highlighted */
}

.msg-row.received .msg-sender {
    color: var(--cyan-soft); /* pale cyan for other party */
}

.msg-row.system {
    color: var(--orange-soft);
    font-style: italic;
    text-align: center;
    border-top: 1px dashed var(--warning-soft);
    border-bottom: 1px dashed var(--warning-soft);
    margin: 15px 0;
    padding: 6px 0;
}

/* Liste des contacts */
.contact-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-item {
    padding: 10px 8px;
    border-bottom: 1px dotted var(--grey);
    cursor: pointer;
    color: var(--brand-muted);
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

.contact-item:hover {
    background-color: var(--accent-soft);
    color: var(--brand-white);
}

.contact-item.active {
    background-color: var(--brand-accent);
    color: var(--brand-white);
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.status-dot.online { background-color: #66ffb3; }
.status-dot.busy { background-color: #ffb86b; }
.status-dot.offline { background-color: var(--brand-accent-2); }

/* Bouton envoyer */
#send-btn {
    background-color: var(--brand-accent);
    color: var(--brand-white);
    border: none;
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 8px;
    border-radius: 6px;
}

#send-btn:hover {
    background-color: var(--brand-accent-2);
    color: var(--brand-bg);
}

/* Ajout pour l'état d'erreur */
.msg-row.error {
    color: var(--brand-danger);
    font-weight: 700;
    background-color: var(--danger-soft);
    border-left: 3px solid var(--danger-soft);
    padding-left: 10px;
}

/* Optionnel : Griser l'input pour montrer visuellement la difficulté */
#message-input::placeholder {
    color: var(--brand-muted);
    opacity: 0.7;
}