/* =========================
   RESET
========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14.4px;
}

body {
    min-height: 100vh;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #17324d;
    background: #f7fafc;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    border: none;
    cursor: pointer;
}


/* =========================
   VARIABILI
========================= */

:root {
    --sidebar-width: 243px;

    --primary: #008fd3;
    --primary-dark: #006ca6;
    --primary-light: #edf8fd;

    --secondary: #41bce8;

    --yellow: #f8c63d;
    --orange: #f59a23;

    --background: #f7fafc;
    --surface: #ffffff;

    --text: #17324d;
    --text-secondary: #738394;

    --border: #e3edf3;

    --shadow:
        0 9px 27px rgba(25, 75, 105, 0.07);

    --radius: 16px;
}


/* =========================
   LAYOUT GENERALE
========================= */

.dashboard-layout {
    min-height: 100vh;
}

.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;

    display: flex;
    flex-direction: column;

    width: var(--sidebar-width);
    padding: 22px 16px;

    color: var(--text);
    background: #ffffff;

    border-right: 1px solid var(--border);

    box-shadow:
        7px 0 22px rgba(25, 75, 105, 0.05);
}

.sidebar-header {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 81px;
    margin-bottom: 25px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
}

.sidebar-logo img {
    display: block;

    width: 153px;
    height: auto;

    object-fit: contain;
}

.sidebar-close {
    position: absolute;
    top: 50%;
    right: 0;

    display: none;

    width: 34px;
    height: 34px;

    color: var(--primary);
    background: transparent;
    border-radius: 9px;

    transform: translateY(-50%);
}

.sidebar-close:hover {
    background: var(--primary-light);
}


/* =========================
   MENU
========================= */

.sidebar-menu {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.menu-link {
    position: relative;

    display: flex;
    align-items: center;
    gap: 13px;

    min-height: 47px;
    padding: 12px 14px;

    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 650;

    border-radius: 12px;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.menu-link:hover {
    color: var(--primary);
    background: var(--primary-light);
    transform: translateX(3px);
}

.menu-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.menu-link.active::before {
    position: absolute;
    top: 50%;
    left: -16px;

    width: 4px;
    height: 25px;

    content: "";

    background: var(--yellow);
    border-radius: 0 8px 8px 0;

    transform: translateY(-50%);
}

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 27px;
    height: 27px;

    color: var(--primary);
    font-size: 1.25rem;
}


/* =========================
   UTENTE SIDEBAR
========================= */

.sidebar-user {
    display: grid;
    grid-template-columns: 41px minmax(0, 1fr) 36px;
    gap: 11px;
    align-items: center;

    margin-top: 22px;
    padding: 13px 10px;

    background: #f8fbfd;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 41px;
    height: 41px;

    color: #17324d;
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0.04em;

    background: var(--yellow);
    border-radius: 50%;

    box-shadow:
        0 6px 16px rgba(245, 154, 35, 0.15);
}

.user-info {
    min-width: 0;
}

.user-info strong,
.user-info span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info strong {
    margin-bottom: 3px;

    color: var(--text);
    font-size: 0.88rem;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.logout-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    color: var(--text-secondary);
    font-size: 1.2rem;

    background: transparent;
    border-radius: 10px;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.logout-button:hover {
    color: var(--primary);
    background: var(--primary-light);
    transform: translateX(2px);
}


/* =========================
   TOPBAR
========================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 85px;
    padding: 16px 34px;

    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(14px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-subtitle {
    margin-bottom: 3px;

    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.topbar h1 {
    color: var(--text);
    font-size: 1.8rem;
    line-height: 1.1;
}

.topbar-date {
    padding: 10px 14px;

    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 650;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 6px 18px rgba(25, 75, 105, 0.05);
}

.menu-button {
    display: none;

    width: 41px;
    height: 41px;

    color: var(--primary);
    font-size: 1.35rem;

    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 6px 16px rgba(25, 75, 105, 0.06);
}


/* =========================
   OVERLAY MOBILE
========================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;

    display: none;

    background: rgba(23, 50, 77, 0.38);
    backdrop-filter: blur(3px);
}


/* =========================
   RESPONSIVE GENERALE
========================= */

@media (max-width: 850px) {

    .sidebar {
        transform: translateX(-100%);

        transition:
            transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-button {
        display: block;
    }

    .topbar {
        padding: 14px 20px;
    }

}

@media (max-width: 620px) {

    .topbar-date {
        display: none;
    }

    .topbar h1 {
        font-size: 1.45rem;
    }

}

@media (max-width: 380px) {

    .sidebar {
        width: 90%;
    }

}