/* Base variables for the entire project */
:root {
    --primary-color: #1e3a8a;
    --primary-hover: #1e40af;
    --navbar-text: #374151;
    --navbar-text-hover: #1e3a8a;
    --navbar-hover-bg: #f3f4f6;
    --bg-main: #f8fafc;
    --text-main: #1f2937;
}

/* Base styles to ensure consistency */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Inter', sans-serif;
}


/* Base transition for interactive elements */
a,
button,
input,
select,
textarea {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}


.navbar-fixed {
    position: fixed;
    top: 0px;
    left: 0;
    z-index: 1000;
    width: 100%;
    transition: all 0.3s ease;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.navbar-container {
    max-width: 90rem;
    margin: 0 auto;
}

/* Navbar Inner Layout */
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .navbar-inner {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .navbar-inner {
        padding: 0 2rem;
    }
}

/* Navbar Brand text link styling */
.navbar-brand {
    display: flex;
    align-items: center;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: hsl(210, 55%, 38%);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: color 150ms ease;
}

.navbar-brand:hover {
    color: hsl(210, 60%, 48%);
}

/* Navbar themable link */
.navbar-link {
    color: var(--navbar-text);
    font-weight: 500;
}

.navbar-link:hover {
    color: var(--navbar-text-hover);
    background-color: var(--navbar-hover-bg);
}

/* Navbar themable button */
.navbar-btn {
    color: var(--navbar-text);
    font-weight: 500;
}

.navbar-btn:hover {
    color: var(--navbar-text-hover);
    background-color: var(--navbar-hover-bg);
}

/* Navbar Transitions on Scroll */
.navbar-fixed.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    height: 4rem;
}

/* Responsive navbar adjustments */
@media (max-width: 1024px) {
    .navbar-fixed {
        max-width: 100%;
    }
}

/* Compact desktop nav links on smaller laptops (lg–xl) to prevent the
   six long menu labels from overflowing the fixed-height bar. */
@media (min-width: 1024px) and (max-width: 1279px) {
    .navbar-inner .navbar-link,
    .navbar-inner .navbar-btn,
    .navbar-inner .navbar-ndus2019-btn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Dropdown menu professional styling */
.dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
}

/* Show dropdown on hover or when parent has .open class (mobile) */
.dropdown:hover>.dropdown-menu,
.dropdown.open>.dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Invisible bridge to prevent losing hover between button and menu */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}


/* Keep dropdown open when hovering the menu */
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Dropdown arrow rotation */
.dropdown:hover>.dropdown-button svg.chevron,
.dropdown.open>.dropdown-button svg.chevron {
    transform: rotate(180deg);
}

/* Nested Dropdown Styling */
.nested-dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 150ms ease-in-out;
    pointer-events: none;
}

.dropdown-item:hover>.nested-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* Invisible bridge for nested dropdowns (sideways) */
.nested-dropdown-menu::before {
    content: '';
    position: absolute;
    top: 0;
    right: -20px;
    width: 20px;
    height: 100%;
    background: transparent;
}


/* ═══════════════════════════════════════════════════════════════════════
   SIDE NAVBAR  — mobile-first, real-device quality
   ═══════════════════════════════════════════════════════════════════════ */

/* 1 — Drawer panel ---------------------------------------------------- */
.side-navbar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(85vw, 320px);    /* never wider than 85% of screen */
    /* height fallback chain for all browsers:
       1. 100%                      = universal base
       2. calc(var(--vh)*100)       = JS-driven (old Android WebView / Samsung Internet)
       3. -webkit-fill-available    = iOS Safari < 15.4
       4. 100dvh                    = modern (Chrome 108+, Safari 15.4+, Firefox 101+) */
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
    height: -webkit-fill-available;
    height: 100dvh;
    background: #ffffff;
    z-index: 10000;
    transform: translateX(110%);     /* slightly beyond edge to hide shadow */
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
                visibility  0.32s;
    visibility: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.14);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;  /* smooth momentum scroll on iOS */
    overscroll-behavior: contain;       /* stop scroll chaining to body */
    /* safe area for notch / Dynamic Island / home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-right:  env(safe-area-inset-right,  0);
    display: flex;
    flex-direction: column;
    /* prevent text-size adjust on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.side-navbar.open {
    transform: translateX(0);
    visibility: visible;
}

/* Hide completely on desktop (lg+) — prevents focus trap on large screens */
@media (min-width: 1024px) {
    .side-navbar {
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateX(110%) !important;
    }
    .side-navbar-backdrop {
        display: none !important;
    }
}

/* 2 — Backdrop --------------------------------------------------------- */
.side-navbar-backdrop {
    position: fixed;
    top: 0;    /* explicit TRBL — `inset` not supported on old Android WebView */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.52);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;   /* prevent scroll-through on backdrop tap */
}

.side-navbar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* 3 — Body scroll lock ------------------------------------------------- */
/*
   The position:fixed trick is required on iOS Safari to truly lock scroll.
   On Android Chrome, `overflow:hidden` alone is usually enough, but
   we apply both for universal coverage. `width:100%` prevents width
   collapse that Android Chrome causes when position:fixed is set.
*/
body.side-navbar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;       /* prevent width collapse on Android Chrome */
    left: 0;
    right: 0;
}

/* 4 — Header strip ----------------------------------------------------- */
.side-nav-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;             /* never shrink — always visible */
    /* safe area on left-handed landscape mode */
    padding-left: max(1.25rem, env(safe-area-inset-left));
}

.side-nav-header span {
    font-weight: 700;
    font-size: 1rem;
    color: hsl(210,55%,40%);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Close button — big enough touch target */
#side-navbar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    color: #64748b;
    -webkit-tap-highlight-color: transparent;
    transition: background 180ms;
}
#side-navbar-close:hover,
#side-navbar-close:focus-visible {
    background: #f1f5f9;
    color: #1e293b;
}

/* 5 — Scrollable content area ------------------------------------------ */
.side-nav-content {
    padding: 0.625rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 6 — Nav links and buttons — 48px min touch target ------------------- */
.side-nav-link,
.side-nav-button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;           /* WCAG 2.5.5 — 48px touch target */
    padding: 0.7rem 1rem;
    color: hsl(220, 20%, 35%);
    text-decoration: none;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.5rem;
    margin-bottom: 0.125rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 160ms, color 160ms;
    justify-content: space-between;  /* push chevron to right */
}

.side-nav-link:hover,
.side-nav-link:focus-visible,
.side-nav-button:hover,
.side-nav-button:focus-visible {
    background: hsl(210, 50%, 95%);
    color: hsl(210, 55%, 38%);
    outline: none;
}

.side-nav-button.active {
    color: hsl(210, 55%, 38%);
    background: hsl(210, 50%, 95%);
}

/* 7 — Chevron — rotates smoothly on open/close ----------------------- */
.side-nav-chevron {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.side-nav-button[aria-expanded="true"] .side-nav-chevron {
    transform: rotate(180deg);
    color: hsl(210, 55%, 48%);
}

/* 8 — Dropdown — smooth slide-down via max-height animation ---------- */
.side-nav-dropdown {
    max-height: 0;
    overflow: hidden;
    background: hsl(220, 22%, 97%);
    border-radius: 0.5rem;
    margin: 0.125rem 0.25rem;
    transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity    240ms ease;
    opacity: 0;
    /* display:none is replaced with max-height trick */
}

.side-nav-dropdown.open {
    max-height: 900px;          /* large enough for any dropdown */
    opacity: 1;
}

.side-nav-dropdown-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    color: hsl(220, 15%, 45%);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 150ms, color 150ms;
}

.side-nav-dropdown-link:hover,
.side-nav-dropdown-link:focus-visible {
    background: hsl(210, 50%, 92%);
    color: hsl(210, 55%, 34%);
    outline: none;
}

/* 9 — Nested dropdown ------------------------------------------------- */
.side-nav-nested-dropdown {
    max-height: 0;
    overflow: hidden;
    background: hsl(220, 15%, 93%);
    border-radius: 0.375rem;
    margin: 0.125rem 0.25rem 0.125rem 1.25rem;
    transition: max-height 260ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity    220ms ease;
    opacity: 0;
}

.side-nav-nested-dropdown.open {
    max-height: 600px;
    opacity: 1;
}

.side-nav-nested-dropdown-link {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 1rem 0.45rem 1.75rem;
    color: hsl(220, 18%, 42%);
    text-decoration: none;
    font-size: 0.8125rem;
    border-radius: 0.25rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 140ms, color 140ms;
}

.side-nav-nested-dropdown-link:hover,
.side-nav-nested-dropdown-link:focus-visible {
    background: hsl(210, 40%, 88%);
    color: hsl(210, 55%, 32%);
    outline: none;
}

/* 10 — Hamburger toggle button ---------------------------------------- */
.side-navbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 0.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background 180ms;
}

.side-navbar-toggle:hover,
.side-navbar-toggle:focus-visible {
    background: rgba(0, 0, 0, 0.07);
    outline: none;
}

@media (min-width: 1024px) {
    .side-navbar-toggle {
        display: none;
    }
}

/* Footer — color set via inline style in base.html */
footer {
    /* No !important override — inline style in base.html controls footer bg */
}

.visitor-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom Profile Image Sizing Classes */
.w-30 {
    width: 7.5rem !important; /* 120px */
}
.w-33 {
    width: 8.25rem !important; /* 132px */
}
.h-30 {
    height: 7.5rem !important; /* 120px */
}
.h-35 {
    height: 8.75rem !important; /* 140px */
}

/* SVG icon sizing overrides to prevent layout blow-up when Tailwind utility classes are not fully compiled */
svg.chevron,
.chevron {
    width: 0.875rem !important; /* 14px */
    height: 0.875rem !important;
    display: inline-block;
}

.side-nav-chevron {
    width: 1.125rem !important; /* 18px */
    height: 1.125rem !important;
    display: inline-block;
}

.side-navbar-toggle svg {
    width: 1.5rem !important; /* 24px */
    height: 1.5rem !important;
}

#side-navbar-close svg {
    width: 1.25rem !important; /* 20px */
    height: 1.25rem !important;
}