/* ==========================================
   1. SELF-CONTAINED THEME DEFAULTS
   ========================================== */
:root {
    /* Base Variables (Light Mode Defaults) */
    --menu-bg-primary: #ffffff;
    --menu-bg-secondary: #f8f9fa;
    --menu-bg-card: #ffffff;
    --menu-text-primary: #333333;
    --menu-text-inverse: #ffffff;
    --menu-accent: #00bcd4;
    --menu-border: rgba(0, 0, 0, 0.1);
    --menu-overlay: rgba(0, 0, 0, 0.7);
    --menu-shadow: 0 10px 30px rgba(0,0,0,0.15);
    
    /* Spacing & Motion */
    --menu-space-md: 16px;
    --menu-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides (Automatic & Class-based) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --menu-bg-primary: #121212;
        --menu-bg-secondary: #1e1e1e;
        --menu-bg-card: #252525;
        --menu-text-primary: #e0e0e0;
        --menu-border: rgba(255, 255, 255, 0.1);
    }
}

/* Force specific theme via class if your site uses one */
body.dark-mode {
    --menu-bg-primary: #121212;
    --menu-bg-secondary: #1e1e1e;
    --menu-bg-card: #252525;
    --menu-text-primary: #e0e0e0;
    --menu-border: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   2. BRAND HEADER
   ========================================== */
.brand-header {
    background: var(--menu-bg-secondary);
    padding: var(--menu-space-md);
    text-align: center;
    border-bottom: 1px solid var(--menu-border);
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--menu-accent);
    text-decoration: none;
}

/* ==========================================
   3. DESKTOP NAVIGATION
   ========================================== */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--menu-bg-primary);
    border-bottom: 1px solid var(--menu-border);
    height: 60px;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 var(--menu-space-md);
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    color: var(--menu-text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--menu-accent);
}

/* ==========================================
   4. HAMBURGER (LTR/RTL Aware)
   ========================================== */
.hamburger {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
}

[dir="ltr"] .hamburger { left: var(--menu-space-md); }
[dir="rtl"] .hamburger { right: var(--menu-space-md); }

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--menu-text-primary);
    border-radius: 2px;
    transition: 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================
   5. FULLY OPAQUE MOBILE DRAWER
   ========================================== */
.nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    visibility: hidden;
    pointer-events: none;
}

.nav-drawer.active {
    visibility: visible;
    pointer-events: all;
}

/* Backdrop */
.nav-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: var(--menu-overlay);
    opacity: 0;
    transition: opacity var(--menu-transition);
}

.nav-drawer.active .nav-drawer-backdrop {
    opacity: 1;
}

/* Content Container - FORCED OPAQUE */
.nav-drawer-content {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 280px;
    /* !important used to ensure no global styles override the solid background */
    background-color: var(--menu-bg-primary) !important;
    opacity: 1 !important; 
    box-shadow: var(--menu-shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--menu-transition);
}

/* Directional Sliding */
[dir="ltr"] .nav-drawer-content {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid var(--menu-border);
}

[dir="rtl"] .nav-drawer-content {
    right: 0;
    left: auto;
    transform: translateX(100%);
    border-left: 1px solid var(--menu-border);
}

.nav-drawer.active .nav-drawer-content {
    transform: translateX(0);
}

/* Drawer UI Internals */
.drawer-header-mobile {
    padding: 24px var(--menu-space-md);
    background: var(--menu-bg-secondary);
    border-bottom: 1px solid var(--menu-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title-text {
    color: var(--menu-accent);
    font-weight: 800;
    font-size: 1.1rem;
}

.drawer-links {
    padding: var(--menu-space-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Ensure the list container is also opaque */
    background-color: var(--menu-bg-primary); 
    overflow-y: auto;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--menu-bg-card);
    border: 1px solid var(--menu-border);
    border-radius: 12px;
    color: var(--menu-text-primary) !important;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s ease;
}

.drawer-link i {
    width: 20px;
    text-align: center;
    color: var(--menu-accent);
}

.drawer-link:hover {
    background: var(--menu-accent);
    color: var(--menu-text-inverse) !important;
    border-color: var(--menu-accent);
}

.drawer-link:hover i {
    color: var(--menu-text-inverse);
}

/* ==========================================
   6. RESPONSIVE LOGIC
   ========================================== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    
    /* Lock body scroll when drawer is open */
    body.drawer-open {
        overflow: hidden !important;
        touch-action: none;
    }
}