﻿.custom {
    background-color: #C0041C !important;
    border-color: #E00620 !important;
    color: white !important;
    padding: 5px;
    font-size: 16px;
    border-radius: 5px;
}

.custom:hover {
    background-color: #A00318 !important;
    border-color: #E00620 !important;
}

.cancel {
    background-color: #6C757D !important;
    border-color: #5A6268 !important;
    color: white !important;
    padding: 5px;
    font-size: 16px;
    border-radius: 5px;
}

.cancel:hover {
    background-color: #5A6268 !important;
    border-color: #495057 !important;
}

.section-divider {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #007bff;
    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.1);
}

.button-container {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.button-container .e-danger,
.button-container .e-primary {
    width: 120px;
}

/* ── Bottoni responsive (mobile & tablet ≤1279px) ─────────── */
@media (max-width: 1279.98px) {
    .button-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        gap: 8px;
    }

    /* Appiattisce i gruppi interni: i bottoni diventano
       tutti fratelli diretti nello stesso flex container */
    .button-container > .d-flex {
        display: contents;
    }

    /* Tutti i bottoni con la stessa base (33% → 3 per riga),
       sovrascrivendo le larghezze fisse inline (100px / 120px) */
    .button-container .e-btn {
        flex: 1 1 calc(33.333% - 8px) !important;
        width: auto !important;
        min-height: 44px;
    }
}

.no-bg-readonly input[readonly] {
    background-color: transparent !important;
    border: 1px solid #ced4da;
    color: #495057;
}

.chat-messages-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-message-wrapper {
    display: flex;
    width: 100%;
}

.align-left {
    justify-content: flex-start;
    text-align: left;
}

.align-right {
    justify-content: flex-end;
    text-align: right;
}

.chat-message {
    width: fit-content;
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    border: 1px solid rgba(0,0,0,.06);
}

.bg-sender {
    background-color: #007bff;
    color: white;
    border-top-right-radius: 6px;
}

.bg-receiver {
    background-color: #f1f1f1;
    color: black;
    border-top-left-radius: 6px;
}

.chat-message strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    opacity: .75;
}

.chat-timestamp {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    opacity: .65;
    text-align: right;
}

.chat-empty {
    text-align: center;
    color: #777;
    font-size: 14px;
    padding: 8px;
    margin-top: auto;
    opacity: .7;
}

.chat-input {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.chat-textbox {
    flex-grow: 1;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.send-button {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
}

/* ===== TICKET: layout form + chat ===== */

/* Desktop: form e chat affiancati */
.form-chat-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.form-chat-container .form-container {
    flex: 1 1 0;
    min-width: 0;
}

.form-chat-container .chat-container {
    flex: 1 1 0;
    min-width: 0;
}

/* Tab switcher mobile (nascosto su desktop) */
.mobile-ticket-tabs {
    display: none;
}

/* ── Layout ticket su mobile & tablet (≤1279px) ─────────── */
@media (max-width: 1279.98px) {
    .mobile-ticket-tabs {
        display: flex;
        gap: 0;
        margin-bottom: 0.75rem;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid #dee2e6;
    }

    .tab-btn {
        flex: 1;
        padding: 0.65rem 0.5rem;
        font-size: 0.9rem;
        font-weight: 500;
        border: none;
        background-color: #f8f9fa;
        color: #495057;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        transition: background-color 0.15s, color 0.15s;
    }

    .tab-btn.tab-active {
        background-color: #C0041C;
        color: #fff;
    }

    .tab-btn:not(.tab-active):hover {
        background-color: #e9ecef;
    }

    /* Form e chat: colonna, ognuno occupa tutta la larghezza */
    .form-chat-container {
        flex-direction: column;
    }

    .form-chat-container .form-container,
    .form-chat-container .chat-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        flex: none !important;
    }

    /* Pannello non attivo: nascosto */
    .mobile-tab-hidden {
        display: none !important;
    }
}

/* Su desktop il pannello con classe mobile-tab-hidden rimane visibile,
   ma solo se non ha anche l'attributo [hidden] del browser */
@media (min-width: 1280px) {
    .mobile-tab-hidden:not([hidden]) {
        display: block !important;
    }
}

/* ===== NOTIFICHE (dropdown) ===== */

/* Overlay click-outside */
.notif-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1050;
}

/* Dropdown */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px); /* sempre sotto la campanella */
    right: 0;
    left: auto;
    bottom: auto;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 10px;
    z-index: 1051;
    max-height: min(420px, calc(100vh - 90px));
    overflow: hidden; /* header/footer fissi, scroll sulla lista */
}

    /* Scroll solo sulla lista (se vuoi, vedi sotto) */
    .notif-dropdown .notif-list {
        max-height: calc(420px - 92px); /* approx: header+footer */
        overflow-y: auto;
    }

/* Lista notifiche */
.notif-list .notif-item {
    padding: 0.6rem 0.9rem;
    border-left: 3px solid transparent;
    transition: background-color .15s ease, border-color .15s ease;
}

    .notif-list .notif-item:hover {
        background-color: #f8f9fa;
        border-left-color: #dc3545;
    }

/* Titolo */
.notif-title {
    font-weight: 600;
    color: #212529;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Corpo */
.notif-body {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.2;
    margin-top: 2px;
}

/* Orario */
.notif-time {
    font-size: 0.7rem;
    color: #adb5bd;
    white-space: nowrap;
}

/* Mobile: dropdown sempre dentro lo schermo */
@media (max-width: 576px) {
    .notif-dropdown {
        position: fixed;
        top: 56px; /* sotto header */
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 80px);
    }

        .notif-dropdown .notif-list {
            max-height: calc(100vh - 80px - 92px);
        }
}



