

:root {
    --sidebar-width: 270px;
    --background-main: #f5f5f3;
    --background-card: #ffffff;
    --sidebar-background: #172226;
    --sidebar-background-hover: #253237;
    --sidebar-active-background: #314045;
    --text-primary: #17252c;
    --text-secondary: #718087;
    --text-light: #f4f6f6;
    --text-sidebar-muted: #aeb8bb;
    --accent: #d8783e;
    --accent-dark: #bd6030;
    --accent-soft: #f5e8df;
    --success: #48a578;
    --success-background: #e7f4ed;
    --border: #e2e5e3;
    --header-height: 82px;
    --radius-small: 10px;
    --radius-medium: 16px;
    --radius-large: 22px;
    --shadow-small: 0 3px 14px rgba(21, 34, 39, 0.06);
    --shadow-medium: 0 15px 45px rgba(21, 34, 39, 0.12);
}


/* RESET */

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: var(--text-primary);
    background: var(--background-main);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

button,
input,
select,
textarea {
    font: inherit;
}


/* STRUTTURA PRINCIPALE */

.app-shell {
    position: relative;
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


/* SIDEBAR */

.app-sidebar {
    position: relative;
    z-index: 40;
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    height: 100vh;
    color: var(--text-light);
    background: var(--sidebar-background);
    overflow: hidden;
    transition: width 220ms ease, flex-basis 220ms ease, transform 220ms ease;
}

.app-shell.sidebar-hidden .app-sidebar {
    width: 0;
    flex-basis: 0;
}


/* Parte superiore sidebar */

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    color: white;
    text-decoration: none;
    white-space: nowrap;
}

    .brand:hover {
        color: white;
    }

.brand-icon {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    color: white;
    background: var(--accent);
    border-radius: 11px;
    font-size: 20px;
    font-weight: 800;
}

.brand-name {
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -0.3px;
}

.sidebar-label {
    padding: 22px 25px 10px;
    color: #738287;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    white-space: nowrap;
}


/* Menu */

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 14px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 50px;
    padding: 11px 14px;
    color: var(--text-sidebar-muted);
    background: transparent;
    border: 0;
    border-radius: 10px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
    font-weight: 620;
    transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

    .menu-item:hover {
        color: white;
        background: var(--sidebar-background-hover);
    }

    .menu-item.active {
        color: white;
        background: var(--sidebar-active-background);
    }

        .menu-item.active::before {
            position: absolute;
        }

        .menu-item.active .menu-icon {
            color: var(--accent);
        }

.menu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
}

    .menu-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.75;
        stroke-linecap: round;
        stroke-linejoin: round;
    }


/* Fondo sidebar */

.sidebar-bottom {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 8px;
    padding: 12px 10px;
    white-space: nowrap;
}

.user-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    color: white;
    background: var(--accent);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 750;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    overflow: hidden;
    color: white;
    font-size: 13px;
    font-weight: 650;
    text-overflow: ellipsis;
}

.user-role {
    color: #879499;
    font-size: 11px;
}

.menu-item-secondary {
    min-height: 44px;
}

.logout-button {
    font-family: inherit;
}


/* MAIN */

.app-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 0;
    min-width: 0;
    height: 100vh;
    background: var(--background-main);
}


/* HEADER FISSO */

.app-header {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 var(--header-height);
    height: var(--header-height);
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 17px;
}

.header-menu-button {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(21, 34, 39, 0.04);
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

    .header-menu-button:hover {
        background: #f8f8f6;
        transform: translateY(-1px);
        box-shadow: var(--shadow-small);
    }

    .header-menu-button:active {
        transform: translateY(0);
    }

    .header-menu-button svg,
    .sidebar-close-mobile svg {
        width: 21px;
        height: 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.page-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page-context {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.35px;
    line-height: 1.2;
    text-transform: uppercase;
}

.header-page-title {
    overflow: hidden;
    margin-top: 2px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -0.35px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    color: #39845f;
    background: var(--success-background);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 650;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(72, 165, 120, 0.13);
}

.mobile-menu-button {
    display: none;
}

.sidebar-close-mobile {
    display: none;
}


/* AREA CHE SCORRE */

.app-content {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.content-container {
    width: 100%;
    max-width: 1600px;
    min-height: 100%;
    margin: 0 auto;
    padding: 28px;
}


/* Scrollbar pių professionale */

.app-content {
    scrollbar-width: thin;
    scrollbar-color: #bec6c7 transparent;
}

    .app-content::-webkit-scrollbar {
        width: 8px;
    }

    .app-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .app-content::-webkit-scrollbar-thumb {
        background: #c5cccd;
        border: 2px solid var(--background-main);
        border-radius: 20px;
    }


/* OVERLAY MOBILE */

.mobile-overlay {
    display: none;
}


/* PUBLIC */

.public-layout {
    min-height: 100vh;
    overflow-y: auto;
}


/* COMPONENTI GENERICI DELLE PAGINE */

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

    .page-heading h1 {
        margin: 3px 0 5px;
        color: var(--text-primary);
        font-size: clamp(28px, 3vw, 38px);
        font-weight: 760;
        letter-spacing: -1.1px;
    }

    .page-heading p {
        max-width: 680px;
        margin: 0;
        color: var(--text-secondary);
        font-size: 14px;
        line-height: 1.6;
    }

.page-eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.dashboard-card {
    padding: 24px;
    background: var(--background-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-small);
}

.primary-action {
    min-height: 42px;
    padding: 10px 17px;
    color: white;
    background: var(--accent);
    border: 0;
    border-radius: var(--radius-small);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

    .primary-action:hover {
        color: white;
        background: var(--accent-dark);
        transform: translateY(-1px);
        box-shadow: 0 7px 18px rgba(216, 120, 62, 0.24);
    }


/* TABLET E MOBILE */

@media (max-width: 991.98px) {

    body {
        overflow: hidden;
    }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 100;
        width: min(290px, 86vw);
        height: 100dvh;
        flex-basis: auto;
        transform: translateX(-105%);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.25);
    }

    .app-shell.sidebar-hidden .app-sidebar {
        width: min(290px, 86vw);
        flex-basis: auto;
    }

    .app-shell.mobile-menu-open .app-sidebar {
        transform: translateX(0);
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 90;
        width: 100%;
        height: 100%;
        padding: 0;
        background: rgba(10, 20, 23, 0.56);
        border: 0;
        opacity: 0;
        visibility: hidden;
        backdrop-filter: blur(3px);
        transition: opacity 200ms ease, visibility 200ms ease;
    }

    .app-shell.mobile-menu-open .mobile-overlay {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .desktop-menu-button {
        display: none;
    }

    .mobile-menu-button {
        display: grid;
    }

    .sidebar-close-mobile {
        display: grid;
        place-items: center;
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        padding: 0;
        color: white;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.09);
        border-radius: 9px;
        cursor: pointer;
    }

    .app-header {
        height: 70px;
        flex-basis: 70px;
        padding: 0 18px;
    }

    .header-right {
        margin-left: auto;
    }

    .content-container {
        padding: 22px 18px;
    }
}


/* TELEFONO */

@media (max-width: 575.98px) {

    .app-header {
        padding: 0 14px;
    }

    .header-left {
        min-width: 0;
    }

    .page-context {
        display: none;
    }

    .header-page-title {
        max-width: 190px;
        font-size: 17px;
    }

    .status-badge {
        display: none;
    }

    .content-container {
        padding: 16px 13px 28px;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

        .page-heading h1 {
            font-size: 28px;
        }

    .primary-action {
        width: 100%;
    }

    .dashboard-card {
        padding: 17px;
        border-radius: 14px;
    }
}


/* Telefoni bassi: sidebar scrollabile */

@media (max-height: 650px) {

    .app-sidebar {
        overflow-y: auto;
    }

    .sidebar-bottom {
        margin-top: 25px;
    }
}


/* Riduzione animazioni */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* =========================================================
   RESTOCKBAR - SIDEBAR COMPATTA A ICONE
   Incolla questo blocco ALLA FINE di wwwroot/css/site.css
   ========================================================= */

:root {
    --sidebar-collapsed-width: 82px;
}

/* La casetta in alto č ora un vero pulsante */
.brand-toggle {
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Desktop: la sidebar non sparisce, diventa una colonna di icone */
@media (min-width: 992px) {
    .app-sidebar {
        transition: width 220ms ease, flex-basis 220ms ease;
    }

    .app-shell.sidebar-collapsed .app-sidebar {
        width: var(--sidebar-collapsed-width);
        flex-basis: var(--sidebar-collapsed-width);
    }

    .app-shell.sidebar-collapsed .sidebar-top {
        justify-content: center;
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-shell.sidebar-collapsed .brand {
        justify-content: center;
        width: auto;
    }

    .app-shell.sidebar-collapsed .brand-name,
    .app-shell.sidebar-collapsed .sidebar-label,
    .app-shell.sidebar-collapsed .menu-item > span:last-child,
    .app-shell.sidebar-collapsed .user-details {
        display: none;
    }

    .app-shell.sidebar-collapsed .sidebar-menu {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-shell.sidebar-collapsed .menu-item {
        position: relative;
        justify-content: center;
        gap: 0;
        min-height: 52px;
        padding: 0;
    }

    .app-shell.sidebar-collapsed .menu-icon {
        flex-basis: 24px;
        width: 24px;
        height: 24px;
    }

        .app-shell.sidebar-collapsed .menu-icon svg {
            width: 22px;
            height: 22px;
        }

    .app-shell.sidebar-collapsed .sidebar-bottom {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-shell.sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .app-shell.sidebar-collapsed .logout-button {
        justify-content: center;
    }

    /* Tooltip professionale quando passi sopra alle icone */
    .app-shell.sidebar-collapsed .menu-item::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        z-index: 200;
        transform: translateY(-50%) translateX(-4px);
        padding: 8px 10px;
        color: #ffffff;
        background: #172226;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
        font-size: 12px;
        font-weight: 650;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
    }

    .app-shell.sidebar-collapsed .menu-item:hover::after,
    .app-shell.sidebar-collapsed .menu-item:focus-visible::after {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(0);
    }
}

/* Mobile: resta il drawer completo e funzionante */
@media (max-width: 991.98px) {
    .brand-toggle {
        width: auto;
    }

    .app-shell.sidebar-collapsed .app-sidebar {
        width: min(290px, 86vw);
        flex-basis: auto;
    }
}