/* ===================================================================
   Light Mode Overrides
   Activated when <html data-theme="light"> is set.
   Dark mode (default) uses inline :root vars in each template.
   =================================================================== */

/* --- Group A: Main app pages (og_home, tax_*, assets, docs) --- */
[data-theme="light"] {
    --bg-void: #d6d3cc;
    --bg-deep: #ccc9c2;
    --bg-panel: #e0ded8;
    --bg-elevated: #d8d5cf;
    --bg-glass: rgba(224, 222, 216, 0.92);
    --bg-input: #e0ded8;

    --sage-primary: #16a34a;
    --sage-bright: #15803d;
    --sage-dim: rgba(22, 163, 74, 0.08);
    --home-warm: #d97706;
    --home-warm-dim: rgba(217, 119, 6, 0.08);
    --accent-cyan: #0891b2;
    --accent-cyan-dim: rgba(8, 145, 178, 0.08);
    --accent-violet: #7c3aed;
    --accent-violet-dim: rgba(124, 58, 237, 0.08);
    --accent-rose: #e11d48;
    --accent-rose-dim: rgba(225, 29, 72, 0.08);
    --accent-blue: #2563eb;
    --accent-blue-dim: rgba(37, 99, 235, 0.08);

    --text-bright: #0f172a;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(22, 163, 74, 0.35);
    --border-input: rgba(0, 0, 0, 0.12);

    --glow-sage: 0 4px 24px rgba(22, 163, 74, 0.1);
    --glow-warm: 0 4px 24px rgba(217, 119, 6, 0.1);
    --glow-blue: 0 4px 24px rgba(37, 99, 235, 0.1);

    /* Group B: Landing / auth pages */
    --bg-navy: #ccc9c2;
    --coral: #dc2626;
    --coral-soft: #ef4444;
    --amber: #d97706;
    --sage: #0284c7;
    --cream: #92400e;
    --cream-soft: rgba(146, 64, 14, 0.8);
    --text: #0f172a;
    --panel: rgba(224, 222, 216, 0.9);

    /* Group C: Repair analysis */
    --bg-primary: #ccc9c2;
    --accent-orange: #ea580c;
    --accent-orange-dim: rgba(234, 88, 12, 0.1);
    --accent-lime: #65a30d;
    --accent-lime-dim: rgba(101, 163, 13, 0.1);
    --danger: #dc2626;
    --danger-dim: rgba(220, 38, 38, 0.1);
    --warning: #d97706;
    --warning-dim: rgba(217, 119, 6, 0.1);
    --border-bright: rgba(8, 145, 178, 0.35);
    --glow-cyan: 0 4px 24px rgba(8, 145, 178, 0.12);
    --glow-orange: 0 4px 24px rgba(234, 88, 12, 0.12);

    /* Group D: Charts (graphical / appraisal analysis) */
    --bg: #d6d3cc;
    --panel-2: #ccc9c2;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-2: #16a34a;
    --accent-red: #dc2626;
    --accent-amber: #d97706;
    --border-light: #b8bcc4;
}

/* --- Smooth transitions for theme switch --- */
[data-theme="light"] body,
[data-theme="dark"] body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Background overlays: soften in light mode --- */
[data-theme="light"] .bg-gradient {
    opacity: 0.35;
}

[data-theme="light"] .bg-grid {
    opacity: 0.03;
}

[data-theme="light"] .grid-bg {
    opacity: 0.4;
}

[data-theme="light"] .bg-canvas {
    opacity: 0.3;
}

[data-theme="light"] .doodle-bg {
    opacity: 0.06;
}

/* --- Orbs: reduce intensity in light mode --- */
[data-theme="light"] .orb {
    opacity: 0.15;
}

/* --- Panels & cards: add subtle shadows in light mode --- */
[data-theme="light"] .panel,
[data-theme="light"] .card,
[data-theme="light"] .module-card,
[data-theme="light"] .feature,
[data-theme="light"] .stat-card,
[data-theme="light"] .info-card,
[data-theme="light"] .form-panel,
[data-theme="light"] .results-panel,
[data-theme="light"] .comp-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* --- Inputs, selects, textareas in light mode --- */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #e0ded8 !important;
    color: #1e293b !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
    background: #e8e6e0 !important;
    border-color: rgba(22, 163, 74, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

/* --- Buttons with hardcoded rgba(255,255,255,...) backgrounds --- */
[data-theme="light"] .signout-btn,
[data-theme="light"] .back-btn,
[data-theme="light"] .back-home-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-secondary);
}

[data-theme="light"] .signout-btn:hover,
[data-theme="light"] .back-btn:hover,
[data-theme="light"] .back-home-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

/* --- Admin button in light mode --- */
[data-theme="light"] .admin-btn {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.25);
}

/* --- Breadcrumb links in light mode --- */
[data-theme="light"] .breadcrumb a {
    color: var(--text-secondary);
}

[data-theme="light"] .breadcrumb a:hover {
    color: var(--text-primary);
}

/* --- Nav bar styling in light mode --- */
[data-theme="light"] .nav-bar {
    border-color: rgba(0, 0, 0, 0.06);
}

/* --- Scrollbar in light mode --- */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #ccc9c2;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #a8a59e;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Footer in light mode --- */
[data-theme="light"] .footer,
[data-theme="light"] .footer-text {
    color: var(--text-secondary);
}

/* --- Logout links on auth pages --- */
[data-theme="light"] .logout-link {
    color: var(--text-secondary);
}

[data-theme="light"] .logout-link:hover {
    color: var(--text-primary);
}

/* --- Google sign-in button on landing (already light, keep as-is) --- */

/* --- Status badges and pills --- */
[data-theme="light"] .status-badge {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.2);
}

/* --- User menu area --- */
[data-theme="light"] .user-menu {
    border-color: rgba(0, 0, 0, 0.06);
}

/* ===================================================================
   Theme Toggle Button
   =================================================================== */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 20, 30, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fbbf24;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    padding: 0;
    outline: none;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Icon display logic */
.theme-toggle .theme-icon-sun,
.theme-toggle .theme-icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
    line-height: 1;
}

.theme-toggle .theme-icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Light mode: swap icons and restyle button */
[data-theme="light"] .theme-toggle {
    background: rgba(224, 222, 216, 0.92);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .theme-toggle:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .theme-toggle .theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="light"] .theme-toggle .theme-icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* --- Responsive: smaller on mobile --- */
@media (max-width: 640px) {
    .theme-toggle {
        width: 40px;
        height: 40px;
        bottom: 16px;
        right: 16px;
        font-size: 1.05rem;
    }
}
