
:root, [data-theme="light"] {
  /* BACKGROUNDS */
  --bg-main: #F8FAFC;
  --dark: #1e1e1e;
  --bg: #f8f9fa;
  --gold-dim: #9a7e50;
  --bg-secondary: #FFFFFF;
  --bg-alt: #EFF3F8;
  --card-bg: #FFFFFF;
  --input-bg: #F1F5F9;
  --ui-panel-bg: rgba(255, 255, 255, 0.95);
  --canvas-bg: #F0FDF4; 
  
  /* TEXT (HIGH CONTRAST) */
  --text: #0F172A;
  --text-dark: #0F172A;
  --muted: #475569;
  --text-light: #475569;
  --header-color: #0F172A;
  
  /* BORDERS & ACCENTS */
  --border: rgba(15, 23, 42, 0.15);
  --border-color: rgba(15, 23, 42, 0.15);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  
  /* BRAND COLORS */
  --gold: #B48A3A; /* Darker gold for better contrast on white */
  --brand-gold: #B48A3A;
  --gold-light: #cfa858;
  --brand-teal: #0F766E;
  --brand-red: #E11D48;
  --brand-green: #10B981;
  
  /* FONTS */
  --font-head: 'Cormorant Garamond', 'Outfit', serif;
  --font-body: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

[data-theme="dark"] {
  /* BACKGROUNDS */
  --bg-main: #0B1120;
  --dark: #0a0908;
  --bg: #111008;
  --gold-dim: #9a7e50;
  --bg-secondary: #1E293B;
  --bg-alt: #0F172A;
  --card-bg: #1E293B;
  --input-bg: #0F172A;
  --ui-panel-bg: rgba(11, 17, 32, 0.95);
  --canvas-bg: #050814; 
  
  /* TEXT (HIGH CONTRAST) */
  --text: #F8FAFC;
  --text-dark: #F8FAFC;
  --muted: #CBD5E1;
  --text-light: #CBD5E1;
  --header-color: #F8FAFC;
  
  /* BORDERS & ACCENTS */
  --border: rgba(255, 255, 255, 0.15);
  --border-color: rgba(255, 255, 255, 0.15);
  --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  
  /* BRAND COLORS */
  --gold: #D4AF37; /* Brighter gold for dark mode */
  --brand-gold: #D4AF37;
  --gold-light: #FDE047;
  --brand-teal: #14B8A6;
}

body { 
    background: var(--bg-main); 
    color: var(--text-dark); 
    font-family: var(--font-body); 
    margin:0; 
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

*, *::before, *::after { box-sizing: border-box; }
img, video, canvas, svg { max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
body.nav-open { overflow: hidden; }

/* UNIFIED LUXURY NAVBAR */
.navbar { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 4%; height: 70px; background: var(--ui-panel-bg); backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 1000; 
}
.nav-logo { 
    font-family: var(--font-head); font-size: 1.4rem; color: var(--brand-gold); 
    font-weight: 800; letter-spacing: 0.05em; text-decoration: none; text-transform: uppercase; 
    min-width: 0;
}
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { 
    color: var(--text-dark); text-decoration: none; font-size: 0.7rem; letter-spacing: 0.12em; 
    text-transform: uppercase; transition: all 0.3s ease; position: relative; font-weight: 800;
}
.nav-links a::after { 
    content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px; 
    background: var(--brand-gold); transition: width 0.3s ease; 
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a:hover, .nav-links a.active { color: var(--brand-gold); }

.nav-utils { display: flex; gap: 12px; align-items: center; }

/* MOBILE MENU TOGGLE */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}
.menu-toggle span {
    width: 25px;
    height: 2px;
    background-color: var(--text-dark);
    transition: 0.3s;
    border-radius: 2px;
}
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 1024px) {
    .menu-toggle { 
        display: flex; 
        position: relative;
        z-index: 1002;
    }
    .nav-logo {
        margin-right: auto;
        font-size: 1.2rem;
        max-width: min(52vw, 280px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--ui-panel-bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0;
        overflow: hidden;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        gap: 15px;
        z-index: 1001;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    .nav-links.active {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    .nav-links a {
        width: 100%;
        text-align: center;
        padding: 15px 0;
        font-size: 1.2rem;
        transform: translateY(20px);
        transition: 0.4s;
    }
    .nav-links.active a {
        transform: translateY(0);
    }
    .nav-links.active a:nth-child(1) { transition-delay: 0.1s; }
    .nav-links.active a:nth-child(2) { transition-delay: 0.15s; }
    .nav-links.active a:nth-child(3) { transition-delay: 0.2s; }
    .nav-links.active a:nth-child(4) { transition-delay: 0.25s; }
    .nav-links.active a:nth-child(5) { transition-delay: 0.3s; }

    .nav-utils { 
        margin-left: 10px; 
        z-index: 1002;
    }
    .theme-toggle span, #playgroundToggleBtn span { display: none; }
    .theme-toggle { padding: 8px; border-radius: 50%; }
    .navbar { height: 64px; }
}

/* OUTLINE BUTTON */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 10px 16px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-outline:hover {
    border-color: var(--brand-gold);
    color: var(--brand-gold);
    background: rgba(180, 138, 58, 0.05);
}

/* THEME TOGGLE BUTTON */
.theme-toggle {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.theme-toggle:hover {
    border-color: var(--brand-gold);
    background: var(--card-bg);
    box-shadow: 0 4px 12px rgba(180, 138, 58, 0.15);
}

/* Fix Input Text Visibility */
.form-input, .form-select, input, select {
    color: var(--text-dark) !important;
    max-width: 100%;
}

table { width: 100%; border-collapse: collapse; }
td, th { overflow-wrap: anywhere; }

@media (max-width: 768px) {
    .btn-outline,
    .theme-toggle,
    button,
    [role="button"] {
        min-height: 40px;
    }

    .panel,
    .est-card,
    .results-card {
        border-radius: 10px;
    }
}

/* TOOLTIPS & ANIMATIONS */
.dim-label { animation: pulse-dim 2s infinite alternate; }
@keyframes pulse-dim { 0% { transform: scale(1); box-shadow: 0 4px 10px rgba(15, 118, 110, 0.3); } 100% { transform: scale(1.05); box-shadow: 0 8px 20px rgba(15, 118, 110, 0.6); } }

.vastu-pulse { background: radial-gradient(circle, rgba(197, 160, 89, 0.8) 0%, rgba(197, 160, 89, 0) 70%); width: 60px; height: 60px; border-radius: 50%; animation: vastu-glow 3s infinite; pointer-events: none; }
@keyframes vastu-glow { 0% { transform: scale(0.8); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(0.8); opacity: 0.5; } }

/* TOOLTIPS & ANIMATIONS */
.dim-label { box-shadow: 0 4px 10px rgba(15, 118, 110, 0.3); }

.vastu-pulse { background: radial-gradient(circle, rgba(197, 160, 89, 0.8) 0%, rgba(197, 160, 89, 0) 70%); width: 60px; height: 60px; border-radius: 50%; animation: vastu-glow 3s infinite; pointer-events: none; }
@keyframes vastu-glow { 0% { transform: scale(0.8); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(0.8); opacity: 0.5; } }

.tip-card { background: var(--card-bg); color: var(--text-dark); padding: 12px 16px; border-radius: 8px; border-left: 4px solid var(--brand-gold); border-top: 1px solid var(--border-color); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); font-size: 11px; font-family: var(--font-body); width: 200px; box-shadow: var(--card-shadow); pointer-events: none; animation: float-tip 4s infinite ease-in-out; opacity: 0; transition: opacity 0.5s; }
.tip-card.visible { opacity: 1; }
.tip-card .tip-title { font-weight: 800; color: var(--brand-gold); margin-bottom: 4px; display: flex; align-items: center; gap: 5px;}
.tip-card .tip-desc { font-weight: 600; color: var(--text-light); line-height: 1.4; }
@keyframes float-tip {
    0% { margin-top: 0px; }
    50% { margin-top: -15px; }
    100% { margin-top: 0px; }
}

.tooltip-container { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; cursor: help; }
.info-icon { font-size: 12px; background: rgba(197, 160, 89, 0.2); color: var(--brand-gold); width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.tooltip-text { visibility: hidden; width: 220px; background-color: var(--card-bg); color: var(--text-dark); text-align: left; border: 1px solid var(--border-color); border-radius: 6px; padding: 8px 10px; position: absolute; z-index: 1000; bottom: 150%; left: 50%; margin-left: -110px; opacity: 0; transition: opacity 0.3s; font-size: 10px; font-family: var(--font-body); font-weight: 600; line-height: 1.4; box-shadow: var(--card-shadow); pointer-events: none; }
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Final shared mobile-nav rules. These intentionally outrank old page-level
   navbar snippets so every page uses the same hamburger behavior. */
@media (max-width: 1024px) {
    .navbar {
        position: sticky !important;
        top: 0;
        height: 64px;
        flex-wrap: nowrap;
    }

    .navbar .menu-toggle {
        display: flex !important;
        width: 44px;
        height: 44px;
        padding: 10px;
        justify-content: center;
        order: 0;
    }

    .navbar .menu-toggle span {
        display: block;
        width: 25px;
        height: 2px;
        flex: 0 0 2px;
        background-color: var(--text-dark);
    }

    .navbar .menu-toggle.active span:nth-child(1),
    .navbar .menu-toggle.open span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .navbar .menu-toggle.active span:nth-child(2),
    .navbar .menu-toggle.open span:nth-child(2) {
        opacity: 0;
    }

    .navbar .menu-toggle.active span:nth-child(3),
    .navbar .menu-toggle.open span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .navbar .nav-logo {
        order: 1;
        flex: 1 1 auto;
        margin: 0 !important;
        min-width: 0;
    }

    .navbar .nav-utils {
        order: 2;
        flex-shrink: 0;
        margin-left: 8px !important;
    }

    .navbar .nav-links {
        display: flex !important;
        position: fixed !important;
        inset: 64px 0 0 0 !important;
        width: 100% !important;
        height: calc(100dvh - 64px) !important;
        max-height: none !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 20px !important;
        gap: 12px !important;
        background: var(--ui-panel-bg) !important;
        border: 0 !important;
        box-shadow: none !important;
        overflow-y: auto !important;
        z-index: 1001 !important;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
        -webkit-backdrop-filter: blur(25px);
        backdrop-filter: blur(25px);
    }

    .navbar .nav-links.active,
    .navbar .nav-links.open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .navbar .nav-links a {
        width: min(420px, 100%) !important;
        padding: 14px 12px !important;
        text-align: center !important;
        border-bottom: 1px solid var(--border-color);
        font-size: 1rem !important;
        transform: none !important;
    }

    .navbar .nav-links a:last-child {
        border-bottom: 0;
    }
}
