/* ============================================================================
   SITE-MASTER.CSS - Global Variables & Base Styles
   //templates/css/site-master.css
   ============================================================================ */

/* Import Inter Font */


/* ==================== CSS VARIABLES ==================== */
:root {
    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Colors - Dark Theme (Default) */
    --bg-primary: #000000;
    --bg-secondary: #333333;
    --bg-elevated: #1a1f3a;
    --bg-hover: #252b4a;
    --text-primary: #e1e8ed;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --accent-primary: #60a5fa;
    --accent-hover: #818cf8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

    /* Button Colors (Theme-specific) */
    --btn-signin-bg: #ffffff;
    --btn-signin-text: #000000;
    --btn-signin-hover-bg: #f3f4f6;
    --btn-signin-hover-border: #e5e7eb;


    /* Status Colors */
    --green: #10b981;
    --red: #ef4444;
    --neutral: #6b7280;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;

    /* Border Radius - Change --radius to update all corners */
    --radius: 4px;
    --radius-sm: var(--radius);
    --radius-md: var(--radius);
    --radius-lg: var(--radius);
    --radius-xl: var(--radius);

    /* Sidenav Variables */
    --sidenav-width-expanded: 240px;
    --sidenav-width-collapsed: 60px;
    --sidenav-bg: #0f1117;
    --sidenav-border: #1f2937;
    --sidenav-text: #9ca3af;
    --sidenav-text-hover: #ffffff;
    --sidenav-active: #4f9eff;
    --sidenav-active-bg: rgba(79, 158, 255, 0.1);
    --sidenav-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --mobile-header-top: 10px;
}


@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


/* ==================== THEME VARIATIONS ==================== */

/* Dark Theme (Explicit) */
body.dark-mode {
    --bg-primary: #000000;
    --bg-secondary: #333333;
    --bg-elevated: #334155;
    --bg-hover: #252b4a;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border-color: #2d3748;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    /* Button Colors - Dark Theme */
    --btn-signin-bg: #ffffff;
    --btn-signin-text: #000000;
    --btn-signin-hover-bg: #f3f4f6;
    --btn-signin-hover-border: #e5e7eb;
}

/* Light Theme */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-elevated: #ffffff;
    --bg-hover: #f9fafb;
    --text-primary: #1a1a1a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e5e7eb;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);

    /* Button Colors - Light Theme */
    --btn-signin-bg: #000000;
    --btn-signin-text: #ffffff;
    --btn-signin-hover-bg: #1a1a1a;
    --btn-signin-hover-border: #333333;
}

/* ==================== BASE STYLES ==================== */

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    margin: 0;
    padding-top: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==================== LAYOUT ==================== */
#container {
    max-width: 1580px;
    margin: 0 auto;
    padding: 2rem;
}
.container {
    max-width: 1580px;
    margin: 0 auto;
    padding: 2rem;
}


#header .container,
#header .grid-lg {
    padding: 0;
}

/* ==================== TYPOGRAPHY ==================== */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}



.ticker-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

.ticker-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* ==================== COMPONENTS ==================== */

/* Cards */
.card, .panel {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* Forms */
input, textarea, select {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Tables - base reset only, component styles in data-table.css */
table {
    width: 100%;
    border-collapse: collapse;
}

/* ==================== UTILITIES ==================== */

.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.neutral { color: var(--neutral) !important; }

/* Messages */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

/* ==================== AD RESPONSIVE ==================== */
/* Show/hide ads based on viewport */
.ad-desktop { display: block; }
.ad-tablet { display: none; }
.ad-mobile { display: none; }

.ad-desktop, .ad-tablet, .ad-mobile {
    text-align: center;
    margin: 20px auto;
    padding: 10px 0;
}

@media (max-width: 1024px) {
    .ad-desktop { display: none; }
    .ad-tablet { display: block; }
    .ad-mobile { display: none; }
}

@media (max-width: 768px) {
    .ad-desktop { display: none; }
    .ad-tablet { display: none; }
    .ad-mobile { display: block; }
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
}

/* ==================== FOOTER ==================== */

#footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    padding: 12px 0;
}

/* Mobile footer nav - hidden on desktop */
.footer-mobile-nav {
    display: none;
}

/* Desktop footer - shown by default */
.footer-desktop {
    display: block;
}

@media (max-width: 1024px) {
    .footer-mobile-nav {
        display: block;
        padding: 20px 0;
    }

    .footer-desktop {
        display: none;
    }

    .footer-nav-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 15px;
    }

    .footer-nav-col {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .footer-nav-col a {
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 13px;
        padding: 4px 0;
    }

    .footer-nav-col a:hover {
        color: var(--text-primary);
    }

    .footer-nav-right {
        border-left: 1px solid var(--border-color);
        padding-left: 15px;
    }
}

#footer .footer-content {
    max-width: 1780px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

#footer .footer-main {
    text-align: center;
    margin-bottom: 4px;
}

#footer .footer-main .copyright {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

#footer .footer-main .year-highlight {
    font-weight: 600;
    color: var(--text-primary);
}

#footer .footer-disclaimer {
    text-align: center;
    margin-bottom: 6px;
    order: 2;
}

#footer .footer-disclaimer p {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

#footer .footer-links {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
}

#footer .footer-nav {
    order: 1;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#footer .footer-social {
    order: 3;
    display: flex;
    gap: 15px;
}

#footer .footer-nav a,
#footer .footer-social a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s ease;
}

#footer .footer-nav a:hover,
#footer .footer-social a:hover {
    color: var(--accent-primary);
}

/* Footer Mobile & Tablet */
@media (max-width: 1024px) {
    #footer .footer-links {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    #footer .footer-nav {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    #footer .footer-social {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    #footer .footer-disclaimer {
        order: 3;
        margin-top: 1rem;
    }

    #footer .footer-disclaimer p {
        text-align: center;
    }
}

/* ============================================================================
   HEADER STYLES
   ============================================================================ */

/* ==================== STATIC HEADER (NOT STICKY) ==================== */

#header {
    position: relative;
    width: 100%;
    z-index: 1000;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

/* ==================== NAVBAR CONTAINER ==================== */

#header .navbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0.5rem 1.5rem;
    width: 100%;
    margin: 0 auto;
    position: relative;
    gap: 2rem;
}

/* ==================== LOGO SECTION ==================== */

#header .navbar-section.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#header .navbar-section.logo .navbar-brand {
    display: flex;
    align-items: center;
}

#header .navbar-section.logo .navbar-brand img {
    max-height: 58px;
    width: auto;
    transition: filter 0.3s ease;
}

body.dark-mode #header .navbar-section.logo .navbar-brand img {
    filter: brightness(0) invert(1);
}

/* ==================== PAGE TITLE IN HEADER ==================== */

.navbar-section.page-title-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

@media (max-width: 768px) {
    .navbar-section.page-title-section {
        display: none;
    }
}

/* ==================== USER MENU ==================== */

.navbar-section.user-menu {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Sign In Button (logged out state) - Uses theme variables */
.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--btn-signin-bg);
    color: var(--btn-signin-text);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--btn-signin-bg);
}

.login-btn:hover {
    background: var(--btn-signin-hover-bg);
    border-color: var(--btn-signin-hover-border);
    transform: translateY(-1px);
}

.login-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    color: var(--btn-signin-text);
}

/* User Dropdown (logged in state) */
.user-dropdown {
    position: relative;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #6366f1 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.user-dropdown-menu.show + .user-trigger .user-chevron,
.user-trigger:focus .user-chevron {
    transform: rotate(180deg);
}

/* User Dropdown Menu */
.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    overflow: hidden;
}

.user-dropdown-menu.show {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-header {
    padding: 16px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-dropdown-email {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.user-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-badge.premium {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

.user-badge.free {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
}

.user-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.user-dropdown-item.upgrade {
    color: var(--accent-primary);
}

.user-dropdown-item.upgrade svg {
    color: var(--accent-primary);
}

.user-dropdown-item.logout {
    color: #ef4444;
}

.user-dropdown-item.logout svg {
    color: #ef4444;
}

/* ==================== HEADER MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
    #header .navbar {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 6px 1rem;
        min-height: 52px;
    }

    #header .navbar-section.logo {
        width: auto;
        margin-bottom: 0;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 0;
        height: 100%;
        display: flex;
        align-items: center;
    }

    #header .navbar-section.logo .navbar-brand img {
        max-height: 42px;
    }

    /* User menu on the right, aligned with hamburger */
    .navbar-section.user-menu {
        position: absolute;
        top: var(--mobile-header-top);
        right: 12px;
    }

    .user-name {
        display: none;
    }

    .user-trigger {
        padding: 4px;
    }

    .user-chevron {
        display: none;
    }

    .user-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 200px;
    }
}

/* ============================================================================
   LEFT SIDEBAR NAVIGATION
   ============================================================================ */

/* Mobile Overlay */
.sidenav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--sidenav-transition);
}

.sidenav-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar Container */
.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidenav-width-expanded);
    background-color: var(--sidenav-bg);
    border-right: 1px solid var(--sidenav-border);
    display: flex;
    flex-direction: column;
    transition: width var(--sidenav-transition);
    z-index: 1000;
    overflow: hidden;
}

.sidenav[data-collapsed="true"] {
    width: var(--sidenav-width-collapsed);
}

/* Adjust body margin when sidebar is present */
body:has(.sidenav) {
    margin-left: var(--sidenav-width-expanded);
    transition: margin-left var(--sidenav-transition);
}

body.sidenav-collapsed {
    margin-left: var(--sidenav-width-collapsed);
}

/* Adjust header padding when sidenav is present (desktop) */
body:has(.sidenav) #header .navbar {
    padding-left: calc(var(--sidenav-width-collapsed) + 1rem);
}

/* Header */
.sidenav-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-bottom: 1px solid var(--sidenav-border);
    min-height: 64px;
}

/* Burger Menu Button */
.burger-menu {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 40px;
    height: 40px;
}

.burger-menu:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.burger-line {
    width: 24px;
    height: 2px;
    background-color: var(--sidenav-text);
    border-radius: 2px;
    transition: all var(--sidenav-transition);
}

.burger-menu:hover .burger-line {
    background-color: var(--sidenav-text-hover);
}

/* Mobile trigger - hidden on desktop */
.sidenav-mobile-trigger {
    display: none;
}

/* Burger animation - X when OPEN, burger when COLLAPSED */
.sidenav:not([data-collapsed="true"]) .burger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.sidenav:not([data-collapsed="true"]) .burger-line:nth-child(2) {
    opacity: 0;
}

.sidenav:not([data-collapsed="true"]) .burger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Navigation */
.sidenav-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

/* Scrollbar styling */
.sidenav-nav::-webkit-scrollbar {
    width: 6px;
}

.sidenav-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidenav-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidenav-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Navigation List */
.sidenav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidenav-item {
    margin: 0.25rem 0;
}

/* Navigation Links */
.sidenav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidenav-text);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.sidenav-link:hover {
    color: var(--sidenav-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidenav-item.active > .sidenav-link {
    color: var(--sidenav-active);
    background-color: var(--sidenav-active-bg);
}

.sidenav-item.active > .sidenav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--sidenav-active);
}

/* Icon Wrapper */
.icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
}

.nav-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) saturate(100%) invert(63%) sepia(7%) saturate(425%) hue-rotate(182deg) brightness(91%) contrast(86%);
    transition: filter 0.2s;
}

.sidenav-link:hover .nav-icon,
.sidenav-item.active .nav-icon {
    filter: brightness(0) saturate(100%) invert(100%);
}

.sidenav-item.active .nav-icon {
    filter: brightness(0) saturate(100%) invert(56%) sepia(89%) saturate(1673%) hue-rotate(195deg) brightness(101%) contrast(101%);
}

/* Link Text */
.link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity var(--sidenav-transition);
}

.sidenav[data-collapsed="true"] .link-text {
    opacity: 0;
    width: 0;
}

/* Chevron for parent items (Level 1) */
.chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: transform 0.2s;
}

.chevron-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(63%) sepia(7%) saturate(425%) hue-rotate(182deg) brightness(91%) contrast(86%);
}

.sidenav-parent[aria-expanded="true"] .chevron {
    transform: rotate(90deg);
}

.sidenav[data-collapsed="true"] .chevron {
    opacity: 0;
    width: 0;
}

/* Submenu (Level 2) */
.sidenav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.2);
}

.sidenav-submenu.expanded {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.sidenav[data-collapsed="true"] .sidenav-submenu {
    display: none;
}

.sidenav-subitem {
    margin: 0;
}

.sidenav-sublink {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem 0.625rem 3rem;
    color: var(--sidenav-text);
    text-decoration: none;
    font-size: 0.813rem;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.sidenav-sublink:hover {
    color: var(--sidenav-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidenav-subitem.active > .sidenav-sublink {
    color: var(--sidenav-active);
    background-color: var(--sidenav-active-bg);
}

.sublink-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--sidenav-text);
    margin-right: 0.75rem;
    transition: background-color 0.2s;
}

.sidenav-sublink:hover .sublink-dot,
.sidenav-subitem.active .sublink-dot {
    background-color: var(--sidenav-active);
}

.sublink-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chevron for subparent items (Level 2 with children) */
.chevron-small {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: transform 0.2s;
}

.chevron-icon-small {
    width: 12px;
    height: 12px;
    filter: brightness(0) saturate(100%) invert(63%) sepia(7%) saturate(425%) hue-rotate(182deg) brightness(91%) contrast(86%);
}

.sidenav-subparent[aria-expanded="true"] .chevron-small {
    transform: rotate(90deg);
}

/* Sub-submenu (Level 3 - Grandchildren) */
.sidenav-subsubmenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.3);
}

.sidenav-subsubmenu.expanded {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.sidenav[data-collapsed="true"] .sidenav-subsubmenu {
    display: none;
}

.sidenav-subsubitem {
    margin: 0;
}

.sidenav-subsublink {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem 4rem;
    color: var(--sidenav-text);
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.sidenav-subsublink:hover {
    color: var(--sidenav-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidenav-subsubitem.active .sidenav-subsublink {
    color: var(--sidenav-active);
    background-color: var(--sidenav-active-bg);
}

.subsublink-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: var(--sidenav-text);
    margin-right: 0.625rem;
    transition: background-color 0.2s;
}

.sidenav-subsublink:hover .subsublink-dot,
.sidenav-subsubitem.active .subsublink-dot {
    background-color: var(--sidenav-active);
}

.subsublink-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tooltip for collapsed state */
.sidenav[data-collapsed="true"] .sidenav-link {
    position: relative;
}

.sidenav[data-collapsed="true"] .sidenav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: #ffffff;
    font-size: 0.813rem;
    white-space: nowrap;
    border-radius: 4px;
    z-index: 1001;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ===================================
   SIDENAV MOBILE RESPONSIVE (≤768px)
   =================================== */

@media (max-width: 768px) {
    /* Sidebar slides in from left, overlays content */
    .sidenav {
        transform: translateX(-100%);
        transition: transform var(--sidenav-transition);
        width: 280px;
        z-index: 1000;
    }

    /* Open state - slides in */
    .sidenav[data-mobile-open="true"] {
        transform: translateX(0);
    }

    /* Hide desktop header on mobile */
    .sidenav-header {
        display: none;
    }

    /* Mobile hamburger trigger - outside sidenav, always visible */
    .sidenav-mobile-trigger {
        display: flex;
        position: fixed;
        top: calc(var(--mobile-header-top) * 2);
        left: 12px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        padding: 10px;
        cursor: pointer;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border-radius: 6px;
    }

    .sidenav-mobile-trigger:hover {
        background-color: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
    }

    .sidenav-mobile-trigger .burger-line {
        width: 24px;
        height: 3px;
        background-color: #d1d5db;
        border-radius: 2px;
        transition: all 0.3s;
    }

    .sidenav-mobile-trigger:hover .burger-line {
        background-color: #fff;
    }

    /* Hide mobile trigger when sidenav is open */
    body.sidenav-mobile-open .sidenav-mobile-trigger {
        display: none;
    }

    /* Body has no left margin on mobile */
    body:has(.sidenav) {
        margin-left: 0;
    }

    body.sidenav-collapsed {
        margin-left: 0;
    }

    /* Reset header padding on mobile */
    body:has(.sidenav) #header .navbar,
    body.sidenav-collapsed #header .navbar {
        padding-left: 1rem;
    }

    /* Prevent body scroll when mobile menu is open */
    body.sidenav-mobile-open {
        overflow: hidden;
    }

    /* Disable collapse state on mobile */
    .sidenav[data-collapsed="true"] {
        width: 280px;
    }

    .sidenav[data-collapsed="true"] .link-text,
    .sidenav[data-collapsed="true"] .chevron {
        opacity: 1;
        width: auto;
    }

    /* Burger always shows normal menu icon on mobile */
    .sidenav .burger-line:nth-child(1),
    .sidenav .burger-line:nth-child(2),
    .sidenav .burger-line:nth-child(3) {
        transform: none;
        opacity: 1;
    }

    /* Only show X when mobile menu is open */
    .sidenav[data-mobile-open="true"] .burger-line:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .sidenav[data-mobile-open="true"] .burger-line:nth-child(2) {
        opacity: 0;
    }

    .sidenav[data-mobile-open="true"] .burger-line:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
}
