/* Messagerie publique HexaTech — V1 */
.hexa-chat-shell {
    max-width: 860px;
    margin: 0 auto;
}

.hexa-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 480px;
    overflow-y: auto;
    padding: 1rem;
    background: #10233f;
    border: 1px solid var(--hexa-surface-border);
    border-radius: var(--radius);
}

.hexa-chat-bubble {
    max-width: 78%;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    line-height: 1.45;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.hexa-chat-bubble.is-visitor {
    align-self: flex-end;
    background: var(--hexa-yellow);
    color: var(--hexa-text-on-yellow);
    border-bottom-right-radius: 4px;
}

.hexa-chat-bubble.is-admin {
    align-self: flex-start;
    background: var(--hexa-blue-deep);
    color: var(--hexa-text-on-dark);
    border: 1px solid var(--hexa-surface-border);
    border-bottom-left-radius: 4px;
}

.hexa-chat-meta {
    font-size: 0.72rem;
    margin-top: 0.25rem;
    opacity: 0.75;
}

.hexa-chat-bubble.is-admin .hexa-chat-meta { color: var(--hexa-text-muted-on-dark); }
.hexa-chat-bubble.is-visitor .hexa-chat-meta { color: var(--hexa-text-muted-on-yellow); }

.hexa-chat-empty {
    text-align: center;
    color: var(--hexa-text-muted-on-dark);
    font-size: 0.95rem;
    padding: 2.5rem 1rem;
}

.hexa-chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.hexa-chat-attachments img {
    max-width: 140px;
    max-height: 140px;
    border-radius: 8px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    cursor: zoom-in;
}

.hexa-chat-noatt {
    font-size: 1.8rem;
    color: #94a9c4;
}

.hexa-chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hexa-chat-composer textarea {
    resize: none;
    flex: 1;
    min-height: 46px;
    max-height: 140px;
}

.hexa-chat-filebtn {
    font-size: 1.4rem;
    line-height: 1;
}

.hexa-chat-files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.hexa-chat-files-preview .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--hexa-yellow-pale);
    color: var(--hexa-text-on-yellow);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
}

.hexa-chat-status {
    min-height: 1.5rem;
    font-size: 0.82rem;
    margin-top: 0.5rem;
}

.hexa-chat-status .spinner-border {
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 0.35rem;
}

@media (max-width: 575.98px) {
    .hexa-chat-bubble { max-width: 92%; }
    .hexa-chat-messages { max-height: 420px; }
    .hexa-chat-attachments img { max-width: 110px; max-height: 110px; }
}

/* ==================================================
   PANNEAU CHAT FLOTTANT (Projet 3)
   Survole le site sans bloquer la navigation.
   ================================================== */
.hexa-float-messagerie-cnt {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3rem;
    text-align: center;
    box-shadow: 0 0 0 2px #08111f;
}

.hexa-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 2.5rem));
    height: min(560px, calc(100vh - 2.5rem));
    background: #0b1a30;
    border: 1px solid var(--hexa-surface-border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.hexa-chat-panel[hidden] { display: none; }

.hexa-chat-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    background: #10233f;
    border-bottom: 1px solid var(--hexa-surface-border);
}

.hexa-chat-panel-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--hexa-yellow);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hexa-chat-panel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border: 1px solid var(--hexa-surface-border);
    border-radius: 8px;
    background: transparent;
    color: var(--hexa-text-on-dark);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.hexa-chat-panel-btn:hover,
.hexa-chat-panel-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--hexa-yellow);
}
.hexa-chat-panel-btn:focus-visible {
    outline: 3px solid var(--hexa-blue);
    outline-offset: 2px;
}

.hexa-chat-panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    overflow: auto;
}

.hexa-chat-panel-body .hexa-chat-messages {
    flex: 1;
    min-height: 0;
    max-height: none;
}

.hexa-chat-panel-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.hexa-chat-panel.is-minimized .hexa-chat-panel-body { display: none; }

/* Messages d'état du panneau (classes dédiées : ne pas collider avec les
   heuristiques alert-* des pages publiques, le panneau est sur tous les
   gabarits). */
.hexa-chat-error {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(220, 53, 69, 0.45);
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.14);
    color: #ffb3b3;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.hexa-chat-locked {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 193, 7, 0.45);
    border-radius: 8px;
    background: rgba(255, 193, 7, 0.12);
    color: #ffe08a;
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .hexa-chat-panel {
        right: 0.6rem;
        left: 0.6rem;
        bottom: 0.6rem;
        width: auto;
        height: min(88dvh, calc(100vh - 1.2rem));
    }
    .hexa-chat-panel-body .hexa-chat-messages { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hexa-chat-panel,
    .hexa-float-messagerie {
        transition: none;
    }
}