/*
 * Studio Box — brand sopra Metronic 8.3.3 (Demo 1).
 * Il colore si cambia solo dalle variabili --fb-*: nessuna ricompilazione SASS.
 */

:root {
    --fb-primary: #1E3A8A;
    --fb-primary-rgb: 30, 58, 138;
    --fb-primary-active: #172E6E;
    --fb-primary-light: #E8ECF6;
    --fb-logo-accent: #93C5FD;
}

:root,
[data-bs-theme="light"] {
    --bs-primary: var(--fb-primary);
    --bs-primary-rgb: var(--fb-primary-rgb);
    --bs-primary-active: var(--fb-primary-active);
    --bs-primary-light: var(--fb-primary-light);
    --bs-primary-clarity: rgba(var(--fb-primary-rgb), 0.2);
    --bs-primary-bg-subtle: var(--fb-primary-light);
    --bs-primary-border-subtle: rgba(var(--fb-primary-rgb), 0.35);
    --bs-primary-text-emphasis: var(--fb-primary-active);
    --bs-text-primary: var(--fb-primary);
    --bs-link-color: var(--fb-primary);
    --bs-link-color-rgb: var(--fb-primary-rgb);
    --bs-link-hover-color: var(--fb-primary-active);
    --bs-component-active-bg: var(--fb-primary);
    --bs-component-checked-bg: var(--fb-primary);
    --bs-component-hover-color: var(--fb-primary);
    --bs-menu-link-color-hover: var(--fb-primary);
    --bs-menu-link-color-show: var(--fb-primary);
    --bs-menu-link-color-here: var(--fb-primary);
    --bs-menu-link-color-active: var(--fb-primary);
    --bs-nav-pills-link-active-bg: var(--fb-primary);
    --bs-progress-bar-bg: var(--fb-primary);
    --bs-scrolltop-bg-color: var(--fb-primary);
    --bs-scrolltop-bg-color-hover: var(--fb-primary-active);
}

/* Logo nella sidebar scura */
.fb-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.fb-logo img {
    height: 28px;
}

.fb-logo-testo {
    color: #FFFFFF;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.fb-logo-testo span {
    color: var(--fb-logo-accent);
}

.fb-logo-chiaro .fb-logo-testo {
    color: var(--bs-gray-900);
}

.fb-logo-chiaro .fb-logo-testo span {
    color: var(--fb-primary);
}

[data-kt-app-sidebar-minimize="on"]:not([data-kt-app-sidebar-hover="on"]) .fb-logo-testo {
    display: none;
}

/* Pannello del brand nelle pagine di accesso */
.fb-auth-aside {
    background:
        radial-gradient(circle at 85% 15%, rgba(var(--fb-primary-rgb), 0.55) 0, transparent 45%),
        linear-gradient(160deg, var(--fb-primary) 0%, #0B1530 100%);
    color: #FFFFFF;
}

.fb-auth-aside .fb-logo img {
    height: 44px;
}

.fb-auth-aside .fb-logo-testo {
    font-size: 1.75rem;
}

.fb-auth-punto {
    color: rgba(255, 255, 255, 0.75);
}

.fb-auth-punto i {
    color: var(--fb-logo-accent);
}

/* Header dell'area clienti: layout dark-header nel colore del brand */
[data-kt-app-layout="dark-header"] .app-header {
    background-color: var(--fb-primary);
}

@media (min-width: 992px) {
    [data-kt-app-layout="dark-header"] .app-header-menu .menu > .menu-item > .menu-link,
    [data-kt-app-layout="dark-header"] .app-header-menu .menu > .menu-item > .menu-link .menu-title {
        color: rgba(255, 255, 255, 0.75);
    }

    [data-kt-app-layout="dark-header"] .app-header-menu .menu > .menu-item.here > .menu-link {
        background-color: rgba(255, 255, 255, 0.14);
    }

    [data-kt-app-layout="dark-header"] .app-header-menu .menu > .menu-item.here > .menu-link .menu-title {
        color: #FFFFFF;
    }
}

.fb-header-btn {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.12);
    border: 0;
}

.fb-header-btn:hover,
.fb-header-btn.show {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.2);
}

.fb-header-btn i {
    color: rgba(255, 255, 255, 0.7);
}

/* Permette a text-truncate di funzionare dentro un elemento flex */
.fb-min-w-0 {
    min-width: 0;
}

/* Legacy da assets/css/style.css (eliminato in fase 9) */
#tabellaComunicazioni th,
#tabellaComunicazioni td {
    vertical-align: middle;
}

/* Cartelle delle categorie (area clienti → Documenti) */
.fb-cartella {
    border: 1px solid var(--bs-gray-200);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fb-cartella:hover {
    border-color: rgba(var(--fb-primary-rgb), 0.35);
}

.fb-cartella.active {
    border-color: var(--fb-primary);
    box-shadow: 0 0 0 3px rgba(var(--fb-primary-rgb), 0.12);
}

/* Testo lungo informativa privacy (area clienti e include condiviso) */
.fb-privacy h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2.25rem;
    margin-bottom: 1rem;
    color: var(--bs-gray-900);
}

.fb-privacy h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--bs-gray-800);
}

.fb-privacy h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.fb-privacy p,
.fb-privacy li {
    margin-bottom: 0.75rem;
    line-height: 1.65;
}

.fb-privacy ul {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

@media (max-width: 767.98px) {
    .fb-cartelle {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.25rem;
    }

    .fb-cartelle > * {
        flex: 0 0 150px;
        scroll-snap-align: start;
    }
}

/* Righe della tabella documenti che su mobile diventano card */
@media (max-width: 767.98px) {
    .fb-tabella-card thead {
        display: none;
    }

    .fb-tabella-card tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.5rem 1rem;
        padding: 1rem 0;
        border-bottom: 1px dashed var(--bs-gray-300);
    }

    .fb-tabella-card tbody td {
        display: block;
        padding: 0 !important;
        border: 0 !important;
    }

    .fb-tabella-card .fb-td-principale {
        grid-column: 1 / -1;
    }

    .fb-tabella-card .fb-td-meta {
        grid-column: 1;
        font-size: 0.85rem;
    }

    .fb-tabella-card .fb-td-azioni {
        grid-column: 2;
        grid-row: 2 / span 2;
        align-self: center;
    }
}

/* Barra inferiore dell'area clienti su mobile */
.fb-tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 105;
    display: flex;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-gray-200);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.06);
    padding-bottom: env(safe-area-inset-bottom);
}

.fb-tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem 0 0.5rem;
    color: var(--bs-gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
}

.fb-tabbar a i {
    color: inherit;
}

.fb-tabbar a.active {
    color: var(--fb-primary);
}

.fb-tabbar .badge {
    position: absolute;
    top: 0.35rem;
    left: calc(50% + 0.4rem);
}

@media (max-width: 991.98px) {
    .fb-con-tabbar {
        padding-bottom: 4.5rem;
    }
}

@media (min-width: 992px) {
    .fb-tabbar {
        display: none;
    }
}

/* Voce attiva della sidebar scura: barra laterale nel colore del brand */
[data-kt-app-layout="dark-sidebar"] .app-sidebar .menu .menu-item .menu-link.active {
    box-shadow: inset 3px 0 0 var(--fb-logo-accent);
}

[data-kt-app-layout="dark-sidebar"] .app-sidebar .menu .menu-item .menu-link.active .menu-icon i {
    color: var(--fb-logo-accent);
}

/* Stati vuoti comuni */
.fb-stato-vuoto .mw-450px {
    max-width: 28rem;
}

/* Skeleton di caricamento */
@keyframes fb-skeleton-pulse {
    0% { opacity: 0.55; }
    50% { opacity: 1; }
    100% { opacity: 0.55; }
}

.fb-skeleton-card {
    pointer-events: none;
}

.fb-skeleton {
    display: block;
    background: var(--bs-gray-200);
    border-radius: 0.35rem;
    min-height: 0.75rem;
    animation: fb-skeleton-pulse 1.4s ease-in-out infinite;
}

.fb-skeleton-line {
    height: 0.75rem;
}

.fb-skeleton-block {
    min-height: 3rem;
}

.fb-skeleton-tabella td {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* DataTables: indicatore di caricamento */
.fb-tabella-card + .dataTables_wrapper .dataTables_processing,
.card-body .dataTables_wrapper .dataTables_processing {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(2px);
    z-index: 2;
    font-weight: 600;
    color: var(--bs-gray-700);
    border-radius: 0.5rem;
}

.card-body .dataTables_wrapper {
    position: relative;
    min-height: 6rem;
}

/* Focus visibile (WCAG) — non rimuovere l’outline Metronic sui controlli nativi */
.app-root .btn:focus-visible,
.app-root a:focus-visible,
.app-root .form-control:focus-visible,
.app-root .form-select:focus-visible,
.app-root .form-check-input:focus-visible {
    outline: 2px solid var(--fb-primary, var(--bs-primary));
    outline-offset: 2px;
    box-shadow: none;
}
