/* ==========================================================================
   Sidebar v2 (.sidenav) — unified admin/client/employee navigation.
   Loaded after responsive.css; outer positioning still comes from
   .sidebar-wrapper rules there (off-canvas mobile / fixed desktop).
   ========================================================================== */

:root {
    --sidenav-bg: #161b27;
    --sidenav-bg-soft: #1d2331;
    --sidenav-border: rgba(255, 255, 255, 0.06);
    --sidenav-text: #9aa5b8;
    --sidenav-text-strong: #eef2f8;
    --sidenav-accent: #7da9e9;
    --sidenav-accent-2: #b8c0ff;
    --sidenav-active-bg: rgba(125, 169, 233, 0.14);
    --sidenav-hover-bg: rgba(255, 255, 255, 0.05);
}

/* The wrapper owns position; the sidenav owns appearance + internal scroll. */
.sidebar-wrapper {
    background: var(--sidenav-bg);
    /* Let the notification dropdown escape; .sidenav__nav scrolls instead. */
    overflow: visible;
}

.sidenav {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--sidenav-bg);
    color: var(--sidenav-text);
    font-size: 0.875rem;
}

/* --- Brand ------------------------------------------------------------- */
.sidenav__brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--sidenav-border);
    flex: 0 0 auto;
}

.sidenav__brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidenav__brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    box-shadow: 0 4px 14px rgba(125, 169, 233, 0.35);
}

.sidenav__brand-text {
    font-family: 'Outfit', 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.16rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--sidenav-text-strong);
}

.sidenav__brand-accent {
    background: linear-gradient(120deg, var(--sidenav-accent), var(--sidenav-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- User card ---------------------------------------------------------- */
.sidenav__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidenav-border);
    flex: 0 0 auto;
}

.sidenav__avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--sidenav-accent), var(--sidenav-accent-2));
}

.sidenav__user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.sidenav__user-name {
    color: var(--sidenav-text-strong);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidenav__user-role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidenav-text);
    opacity: 0.85;
}

.sidenav__bell {
    flex: 0 0 auto;
}

.sidenav__bell .notification-bell-btn i {
    color: var(--sidenav-text) !important;
    transition: color 0.15s ease;
}

.sidenav__bell .notification-bell-btn:hover i {
    color: var(--sidenav-text-strong) !important;
}

/* Keep the dropdown inside the viewport on the 280px-wide rail. */
.sidenav__bell .notification-dropdown {
    min-width: 296px !important;
    max-width: min(360px, calc(100vw - 24px)) !important;
}

/* --- Nav ----------------------------------------------------------------- */
.sidenav__nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 10px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.sidenav__nav::-webkit-scrollbar {
    width: 5px;
}

.sidenav__nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}

.sidenav__section + .sidenav__section {
    margin-top: 14px;
}

.sidenav__section-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #5f6b81;
    padding: 0 10px;
    margin-bottom: 4px;
}

.sidenav .nav-link.sidenav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 1px 0;
    min-height: 38px;
    border-radius: 9px;
    color: var(--sidenav-text);
    font-weight: 500;
    line-height: 1.2;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidenav .nav-link.sidenav__link:hover,
.sidenav .nav-link.sidenav__link:focus-visible {
    background: var(--sidenav-hover-bg);
    color: var(--sidenav-text-strong);
}

.sidenav .nav-link.sidenav__link.active {
    background: var(--sidenav-active-bg);
    color: var(--sidenav-text-strong);
    font-weight: 600;
}

.sidenav .nav-link.sidenav__link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--sidenav-accent), var(--sidenav-accent-2));
}

.sidenav__link-icon {
    width: 20px;
    flex: 0 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.sidenav .nav-link.sidenav__link.active .sidenav__link-icon i {
    color: var(--sidenav-accent);
}

.sidenav__link-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidenav__badge {
    flex: 0 0 auto;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidenav-text-strong);
}

.sidenav__badge--danger {
    background: #e35d6a;
    color: #fff;
}

.sidenav__badge--soft {
    background: rgba(255, 229, 180, 0.18);
    color: #ffd9a0;
}

/* --- Footer ---------------------------------------------------------------- */
.sidenav__footer {
    flex: 0 0 auto;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--sidenav-border);
}

.sidenav__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: #f1a5ad;
    background: rgba(227, 93, 106, 0.12);
    border: 1px solid rgba(227, 93, 106, 0.25);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidenav__logout:hover {
    background: rgba(227, 93, 106, 0.25);
    color: #ffd5d9;
}

/* --- Desktop ------------------------------------------------------------- */
@media (min-width: 768px) {
    /* responsive.css sets overflow:hidden !important on the wrapper, which
       clips the notification dropdown; the sidenav scrolls internally so the
       wrapper can stay visible. */
    .sidebar-wrapper {
        overflow: visible !important;
        overflow-y: visible !important;
    }

    .sidenav {
        height: 100vh;
    }
}

/* On short laptop screens tighten vertical rhythm so nav fits w/o scroll. */
@media (min-width: 768px) and (max-height: 760px) {
    .sidenav__brand {
        padding: 12px 16px 10px;
    }

    .sidenav__user {
        padding: 8px 16px;
    }

    .sidenav .nav-link.sidenav__link {
        min-height: 33px;
        padding: 6px 10px;
    }

    .sidenav__section + .sidenav__section {
        margin-top: 8px;
    }

    .sidenav__footer {
        padding-top: 8px;
        padding-bottom: 8px;
    }
}
