/* =========================================
   LIGHT MODE & THEME TOGGLE
   ========================================= */

/* ── Light Mode CSS Variables ─────────────────────────── */
[data-theme="light"] {
    /* Colors - Whiter Light Theme */
    --bg-primary: #fafbfd;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;

    /* Accent Colors */
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --accent-glow: rgba(37, 99, 235, 0.20);

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Glass Effect - whiter */
    --glass-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(226, 232, 240, 0.8);
    --glass-hover: rgba(37, 99, 235, 0.05);

    /* Shadows (subtle for clean white look) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.08);
}

/* ── Light Mode Overrides ─────────────────────────────── */

/* Animated background toned down */
[data-theme="light"] .bg-gradient {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(37, 99, 235, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(30, 64, 175, 0.03) 0%, transparent 70%);
}

[data-theme="light"] .bg-grid {
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
}

/* Navbar scrolled state */
[data-theme="light"] .navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

/* Glass effect for light mode */
[data-theme="light"] .glass {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 0 40px rgba(37, 99, 235, 0.04);
}

[data-theme="light"] .glass:hover {
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 0 60px rgba(37, 99, 235, 0.06);
}

/* Modal overlays */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* Mobile nav */
[data-theme="light"] .mobile-nav-overlay {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .mobile-nav-drawer {
    background: var(--bg-secondary);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

/* Logo background - slightly different in light mode */
[data-theme="light"] .nav-logo-img {
    background: #f8fafc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Scrollbar for light mode */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Additional Light Mode Whitening ──────────────────── */

/* Section badges and headers */
[data-theme="light"] .section-badge {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.15);
    color: var(--accent-primary);
}

/* Buttons */
[data-theme="light"] .btn-primary {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .btn-outline {
    border-color: #e2e8f0;
    color: var(--text-primary);
}

[data-theme="light"] .btn-outline:hover {
    background: #f1f5f9;
    border-color: var(--accent-primary);
}

/* Input fields */
[data-theme="light"] .input-wrapper,
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .search-input,
[data-theme="light"] .filter-select {
    background: #ffffff;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

[data-theme="light"] .input-wrapper:focus-within,
[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Cards and catalog items */
[data-theme="light"] .catalog-card,
[data-theme="light"] .service-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .about-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .catalog-card:hover,
[data-theme="light"] .service-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

/* Portal discount card */
[data-theme="light"] .portal-discount {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.15);
}

/* Cart summary */
[data-theme="light"] .cart-summary {
    background: #ffffff;
    border: 1px solid #f1f5f9;
}

/* Hero section */
[data-theme="light"] .hero-content {
    text-shadow: none;
}

/* Footer */
[data-theme="light"] .footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* Top bar */
[data-theme="light"] .nav-top-bar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

/* Tab buttons */
[data-theme="light"] .tab-btn {
    color: var(--text-secondary);
    background: transparent;
}

[data-theme="light"] .tab-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
}

/* Toast notifications */
[data-theme="light"] .toast {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tables */
[data-theme="light"] table th {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] table td {
    border-color: #f1f5f9;
}

[data-theme="light"] table tr:hover td {
    background: #fafbfd;
}

/* ── Theme Toggle Switch ──────────────────────────────── */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
}

.theme-toggle {
    position: relative;
    width: 56px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.4s ease, border-color 0.4s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
}

/* Sun and Moon icons inside the track */
.theme-toggle .toggle-icon,
.theme-toggle .toggle-icon svg {
    width: 14px;
    height: 14px;
    z-index: 1;
    transition: opacity 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle .sun-icon,
.theme-toggle .sun-icon svg {
    margin-left: 5px;
    color: #fbbf24;
    opacity: 0.4;
}

.theme-toggle .moon-icon,
.theme-toggle .moon-icon svg {
    margin-right: 5px;
    color: #a5b4fc;
    opacity: 1;
}

/* The sliding thumb */
.theme-toggle .toggle-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    transition: transform 0.4s cubic-bezier(0.68, -0.15, 0.32, 1.15);
    z-index: 2;
}

/* Light mode: thumb slides to the left (sun side) */
[data-theme="light"] .theme-toggle .toggle-thumb {
    transform: translateX(-28px);
}

[data-theme="light"] .theme-toggle .sun-icon,
[data-theme="light"] .theme-toggle .sun-icon svg {
    opacity: 1;
    color: #f59e0b;
}

[data-theme="light"] .theme-toggle .moon-icon,
[data-theme="light"] .theme-toggle .moon-icon svg {
    opacity: 0.4;
}

[data-theme="light"] .theme-toggle {
    background: #e0e7ff;
    border-color: rgba(37, 99, 235, 0.25);
}

/* ── Mobile Theme Toggle ──────────────────────────────── */
.mobile-theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
}

.mobile-theme-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.mobile-theme-label svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* ── Smooth Transition on Theme Change ────────────────── */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.4s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                fill 0.3s ease,
                stroke 0.3s ease !important;
}

/* ── Admin Page Theme Toggle Position ─────────────────── */
.admin-theme-toggle {
    margin-left: auto;
    margin-right: var(--space-md);
}

/* ── Size Dropdown Light Mode Override ────────────────── */
[data-theme="light"] .size-dropdown {
    border-color: #d1d5db;
    background: #fff;
    color: #0f172a;
}
[data-theme="light"] .size-dropdown option {
    background: #fff;
    color: #0f172a;
}

/* ── Cart Ausschreibung Badge Light Mode ─────────────── */
[data-theme="light"] .cart-ausschreibung-badge {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-top-bar .theme-toggle-wrapper {
        display: none;
    }
}
