/* =====================================================================
   support.css — stile comune di pannello operatori e portale (/support).
   Allineato alla console: stesse variabili colore, barra in alto con il
   gradiente bianco -> teal, pulsanti e tabelle presi dai CSS della console
   (bs5Customization.css e datatableCustomization.css, inclusi in agentHead.php).
   Font: quello di Bootstrap a dimensione piena, come la console.
   ===================================================================== */
:root {
    /* Stessi valori di dashboard/.../layout/new/css/layout.css */
    --main-color: #2694a8;
    --main-color-dark: #23788a;
    --main-color-light: #2cb1c6;
    /* Alias usati dai CSS del support */
    --smarts: var(--main-color);
    --smarts-dark: var(--main-color-dark);
    --smarts-light: #eef5f7;
    --bs-link-color: var(--main-color);
    --bs-link-color-rgb: 38, 148, 168;
    --bs-link-hover-color: var(--main-color-light);
    --bs-link-hover-color-rgb: 44, 177, 198;
}

body {
    background: #f4f6f8;
}

a { color: var(--main-color); }
a:hover { color: var(--main-color-light); }

.btn-link { color: var(--main-color); text-decoration: none; }
.btn-link:hover { color: var(--main-color-light); text-decoration: underline; }

.form-control:focus,
.form-select:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 .15rem rgba(38, 148, 168, .18);
}

/* Intestazione dei modal: gradiente della console (come .bg-smarts) */
.bg-smarts {
    --bs-bg-opacity: 1;
    background: linear-gradient(to right, white 10%, #23788a 100%) !important;
    color: #212529 !important;
}

/* ---------------------------------------------------------------------
   Barra in alto: come #topBar della console
   --------------------------------------------------------------------- */
.supportTopBar {
    background: linear-gradient(to right, white 20%, #23788a 100%);
    color: #fff;
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 .2rem 1rem rgba(0, 0, 0, .15);
}

.supportLogo { max-height: 40px; }
.supportTitle { color: #0c0c0c; font-weight: 600; }
.supportNavLink { color: #fff; text-decoration: none; }
.supportNavLink:hover { color: #fff; text-decoration: underline; }
.supportNavLink .badge { vertical-align: text-top; }
.supportUser { display: flex; align-items: center; gap: 8px; }
.supportUser .bi-person-circle { font-size: 1.6em; }
.supportUserLabel { font-style: italic; font-size: .8em; line-height: 1.1; }
.supportRole { font-size: .6em; margin-left: 2px; font-weight: 400; }
.supportLogoutBtn { color: #fff; font-size: 1.6em; cursor: pointer; background: none; border: 0; padding: 0; line-height: 1; }
.supportLogoutBtn:hover { color: #fff; opacity: .8; }

.supportPage { padding: 20px; max-width: 1500px; margin: 0 auto; }

/* Card: come .dataCard della console */
.supportCard {
    background: #fff;
    border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    padding: 16px;
    margin-bottom: 16px;
}

.supportCard h5,
.supportCard h6 {
    font-weight: 600;
    color: var(--main-color);
    margin-bottom: 12px;
}

/* Contatori in testa alla lista messaggi */
.counterBox {
    background: #fff;
    border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    padding: 12px 16px;
    min-width: 160px;
    cursor: pointer;
    border-left: 4px solid var(--main-color);
}
.counterBox.warn { border-left-color: #f0ad4e; }
.counterBox.muted { border-left-color: #adb5bd; }
.counterValue { font-size: 1.6rem; font-weight: 700; color: var(--main-color-dark); }
.counterLabel { font-size: .8rem; color: #6c757d; text-transform: uppercase; }

/* Badge stato / canale / eta' */
.stBadge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 600; }
.stOPEN { background: #e3f4f7; color: #1b6b7a; }
.stRESOLVED { background: #e6f4ea; color: #2e7d32; }
.stCLOSED { background: #eceff1; color: #546e7a; }
.chBadge { font-size: .75rem; color: #546e7a; }
.ageWarn { background: #fff3cd; color: #8a6d00; border-radius: 10px; padding: 2px 8px; font-size: .75rem; font-weight: 600; }
.unassigned { color: #b26a00; font-style: italic; }

#ticketsTable tbody tr { cursor: pointer; }

/* Thread */
.threadMsg { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; max-width: 85%; }
.threadMsg .msgHead { font-size: .8rem; color: #6c757d; margin-bottom: 4px; }
.threadMsg .msgBody { white-space: pre-wrap; word-wrap: break-word; }
.msgREQUESTER { background: #fff; border: 1px solid #dee2e6; }
.msgAGENT { background: var(--smarts-light); border: 1px solid #cfe5ea; margin-left: auto; }
.msgINTERNAL { background: #fff8e1; border: 1px dashed #f0ad4e; margin-left: auto; }
.msgSYSTEM { background: transparent; color: #6c757d; font-size: .8rem; text-align: center; max-width: 100%; padding: 4px; }
.msgAttachments img { max-height: 160px; max-width: 100%; border-radius: 4px; margin: 6px 6px 0 0; border: 1px solid #dee2e6; }

.infoRow { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #f1f3f5; }
.infoRow:last-child { border-bottom: none; }
.infoLabel { color: #6c757d; }
.infoValue { font-weight: 600; text-align: right; word-break: break-word; }

/* Overlay di caricamento */
#loadingOverlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}
#loadingOverlay.d-none { display: none !important; }

/* ---------------------------------------------------------------------
   Login (operatori e portale): come la pagina di login della console
   (publicArea/main/main.css): video a tutto schermo, logo in alto a
   sinistra, titolo al centro, riquadro bianco a destra.
   --------------------------------------------------------------------- */
.loginHeader {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #1d3c45;
}
.loginHeader video {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 1;
}
.loginHeader::after {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, .5); z-index: 2;
}
.loginNavbar { position: absolute; top: 0; left: 0; width: 100%; padding: 1rem; z-index: 10; display: flex; justify-content: space-between; align-items: flex-start; }
.loginNavbar img { height: 80px; }
.loginHero { position: relative; z-index: 3; width: 100%; text-align: center; color: #fff; }
.loginHero h1 { color: #fff; margin: 0; }

#loginFormContainer {
    position: absolute;
    top: 100px;
    right: 40px;
    z-index: 5;
    width: 340px;
    max-width: 90%;
    background: #fff;
    border-radius: 12px;
    padding: 25px 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
#loginFormContainer .loginTitle {
    font-weight: 600;
    color: var(--main-color);
    text-align: center;
    margin-bottom: 4px;
}
#loginFormContainer .loginSubtitle { text-align: center; color: #6c757d; font-size: .875rem; margin-bottom: 15px; }
#loginFormContainer .form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 10px 12px;
    background: whitesmoke;
}
#loginFormContainer .form-control:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 .15rem rgba(13, 110, 253, .25);
}
#loginFormContainer .btn-primary {
    border-radius: 8px;
    padding: 10px;
    font-weight: 500;
}
#loginFormContainer .otpDescription { font-size: .8em; color: dimgrey; margin-bottom: 10px; }

@media (max-width: 768px) {
    .loginHeader { justify-content: flex-start; padding-top: 130px; }
    .loginHero h1 { font-size: 2rem; }
    .loginNavbar img { height: 60px; }
    #loginFormContainer { position: relative; top: auto; right: auto; margin: 20px auto; width: 90%; max-width: 360px; }
}

@media (max-width: 992px) {
    .supportTitle { display: none; }
}

@media (max-width: 768px) {
    .supportPage { padding: 12px; }
    .threadMsg { max-width: 100%; }
    .supportUser .supportUserText, .supportNavLink .navText { display: none; }
    .supportTopBar { padding: 0 10px; }
}

/* Pulsanti a scelta (btn-check): la console forza il colore del testo dei
   btn-outline-primary con !important, quindi da selezionati serve il bianco. */
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active {
    background-color: var(--main-color) !important;
    border-color: var(--main-color) !important;
    color: #fff !important;
}
