/* ============================================================
   1. STRUTTURA MODALE (Overlay e Posizionamento)
   ============================================================ */
.cl-modal-overlay {
    position: fixed;
    /* FONDAMENTALE: Stacca il modale dalla pagina */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Sfondo scuro */
    z-index: 999999;
    /* Sopra a tutto (header, menu, ecc) */
    display: none;
    /* Gestito dal JS (diventa flex) */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    /* Effetto sfocato moderno */
}

/* Il Box Bianco */
.cl-modal-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    /* Larghezza come da screenshot */
    height: 80vh;
    /* Altezza fissa (80% dello schermo) */
    max-height: 650px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header del Modale */
.report-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Non si schiaccia */
}

.report-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.report-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.report-modal-close:hover {
    color: #333;
}


/* ============================================================
   2. LAYOUT CHAT (Sidebar + Area Messaggi)
   ============================================================ */

/* Contenitore Principale */
.cl-qa-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #fff;
}

/* --- COLONNA SINISTRA (Lista) --- */
.cl-qa-sidebar {
    width: 320px;
    /* Larghezza fissa */
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
}

.cl-qa-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: #f4f6f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cl-qa-new-btn {
    background: #0a2838;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cl-qa-new-btn:hover {
    background: #153e54;
}

.cl-qa-list {
    flex: 1;
    overflow-y: auto;
}

/* Elemento Lista Thread */
.cl-qa-thread-item {
    padding: 15px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    background: #fff;
    transition: background 0.2s;
}

.cl-qa-thread-item:hover {
    background: #f9f9f9;
}

.cl-qa-thread-item.active {
    background: #e3f2fd;
    border-left: 4px solid #0a2838;
    /* Bordo laterale attivo */
}


/* --- COLONNA DESTRA (Chat) --- */
.cl-qa-chat-area {
    flex: 1;
    /* Prende tutto il resto */
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    /* Sfondo grigino tipo WhatsApp */
    position: relative;
}

/* Vista Chat */
.cl-qa-chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cl-qa-messages {
    background-color: #e5ddd5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Messaggi (Bolle) */
.cl-qa-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.cl-qa-msg.received {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-top-left-radius: 0;
    margin-right: auto;
}

.cl-qa-msg.sent {
    align-self: flex-end;
    background: #dcf8c6;
    color: #333;
    border-top-right-radius: 0;
    margin-left: auto;
}

.cl-qa-msg-meta {
    display: block;
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: right;
    float: right;
    margin-left: 10px;
}

/* Area Input */
.cl-qa-reply-form {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    align-items: center;
}

.cl-qa-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-family: inherit;
}

.cl-qa-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0a2838;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.cl-qa-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}


/* ============================================================
   3. RESPONSIVE (Mobile)
   ============================================================ */
@media (max-width: 768px) {
    .cl-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .cl-qa-container {
        flex-direction: column;
    }

    .cl-qa-sidebar {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .cl-qa-chat-area {
        width: 100%;
        height: 60%;
    }
}


