/* ==========================================================================
   CassaEdile.Web — CSS custom

   Bridge CSS residuo dopo adozione Material Dashboard 3 (~/lib/material-dashboard/)
   e design-tokens verde foresta (~/css/app-tokens.css).

   Contiene SOLO selettori non forniti da MD3 o con semantica applicativa:
   loader globale, chat assistenza, card-paginazione, rendering markdown
   messaggi spiegativi, dropdown notifiche topbar, termini/condizioni,
   protected-email (hook JS), wizard pratica lavoratore, badge distintivo
   "Altro documento".

   Ordine di caricamento (_Layout.cshtml):
     1. CassaEdileWeb.css                               (questo file)
     2. ~/lib/material-dashboard/css/material-dashboard.min.css
     3. ~/css/app-tokens.css
   ========================================================================== */


/* --------------------------------------------------------------------------
   Loader overlay globale (gestito da CassaEdileWeb.js: linkwait/linkdownload)
   -------------------------------------------------------------------------- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.25);
    z-index: 9999;
}


/* --------------------------------------------------------------------------
   Chat assistenza (Lavoratore/Assistenza/Chat.cshtml)
   -------------------------------------------------------------------------- */
.chat-container {
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 1rem;
}

@media (max-width: 768px) {
    .chat-container {
        max-height: 50vh;
    }
}

.chat-bubble {
    max-width: 75%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .chat-bubble {
        max-width: 85%;
    }
}

.chat-input-area {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--bs-gray-200);
}

.chat-btn-attach,
.chat-btn-send {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge circolare non-letti (chat / ticket) */
.badge-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0;
}


/* --------------------------------------------------------------------------
   Card paginazione "Carica altri..." (helper cwInitCardPagination)
   -------------------------------------------------------------------------- */
.card-pag-item {
    transition: opacity 0.3s ease;
}
.card-pag-item .card {
    border: 0;
    border-radius: 0.65rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    cursor: pointer;
}
.card-pag-item .card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.10);
}

.card-pag-item .card-pag-label {
    font-size: 0.85rem;
    color: #6c757d;
}
.card-pag-item .card-pag-value {
    font-size: 1rem;
    font-weight: 600;
}
.card-pag-item .card-pag-importo {
    font-size: 1.15rem;
    font-weight: 700;
}

.btn-carica-altri {
    border: 1px dashed var(--bs-primary);
    background: transparent;
    color: var(--bs-primary);
    border-radius: 0.65rem;
    padding: 12px;
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.btn-carica-altri:hover {
    background: rgba(var(--bs-primary-rgb), 0.05);
}


/* --------------------------------------------------------------------------
   Messaggi esplicativi (markdown rendering — Markdig)
   -------------------------------------------------------------------------- */
.explanation-content h1,
.explanation-content h2,
.explanation-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}
.explanation-content h1:first-child,
.explanation-content h2:first-child,
.explanation-content h3:first-child {
    margin-top: 0;
}
.explanation-content ul,
.explanation-content ol {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}
.explanation-content p {
    margin-bottom: 0.5rem;
}
.explanation-content p:last-child {
    margin-bottom: 0;
}


/* --------------------------------------------------------------------------
   Notifiche dropdown (topbar lavoratore — iniettate da CassaEdileWeb.js)
   -------------------------------------------------------------------------- */
.notification-menu {
    min-width: 320px;
    max-width: 360px;
    padding: 0;
}

.notification-header {
    font-size: 0.9rem;
}

.notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-section-title {
    padding: 0.5rem 1rem 0.25rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bs-gray-600);
    letter-spacing: 0.05em;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.15s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.06);
    color: inherit;
}

.notification-item-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.notification-item-icon.warning {
    background-color: rgba(var(--bs-warning-rgb), 0.15);
    color: var(--bs-warning);
}

.notification-item-icon.primary {
    background-color: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bs-gray-900);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-subtitle {
    font-size: 0.75rem;
    color: var(--bs-gray-600);
    margin-top: 0.125rem;
}

.notification-empty {
    padding: 2rem 1rem;
}

.notification-footer a {
    font-weight: 500;
}


/* --------------------------------------------------------------------------
   Termini e condizioni (Shared/_TerminiCondizioniContent.cshtml)
   -------------------------------------------------------------------------- */
.terms-content h5.section-title {
    color: var(--bs-primary);
    border-bottom: 2px solid var(--bs-border-color);
    padding-bottom: 8px;
    margin-top: 1.5rem;
}
.terms-content .table th {
    background-color: var(--bs-light);
}


/* --------------------------------------------------------------------------
   Protected email (hook JS: click to reveal)
   -------------------------------------------------------------------------- */
.protected-email {
    cursor: pointer;
    color: var(--bs-primary);
    text-decoration: underline;
    word-break: break-all;
}


/* --------------------------------------------------------------------------
   Wizard pratica lavoratore (Lavoratore/Pratica/Wizard.cshtml)
   -------------------------------------------------------------------------- */
.wizard-card .wizard-step-pending {
    background-color: #fff;
    color: var(--bs-gray-500);
    border: 2px solid var(--bs-gray-300);
}

.wizard-card .form-control-plaintext {
    padding: 0.775rem 1rem;
    background-color: var(--bs-gray-100);
    border: 1px solid var(--bs-gray-200);
    border-radius: 0.475rem;
    color: var(--bs-gray-800);
    font-weight: 500;
}


/* --------------------------------------------------------------------------
   Badge distintivo "Altro documento" (Operatore/ModelloDocumento)
   -------------------------------------------------------------------------- */
.badge.badge-altro-documento {
    background-color: var(--bs-secondary);
    color: #ffffff;
    font-weight: 600;
}


/* --------------------------------------------------------------------------
   Icona stato vuoto (empty-state): icona grande sopra il messaggio
   -------------------------------------------------------------------------- */
.icon-empty-state {
    font-size: 3rem;
}
