/* Theme Toggle & Dark Mode Enhancements */
/* Theme switching UI and related functionality */

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
/* Light theme (default) */
/* :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #dddddd;
} */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 80px;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    width: 60px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow-light);
    transition: var(--theme-transition);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.theme-toggle:focus-visible {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
}

.theme-toggle-slider {
    position: absolute;
    background: var(--accent-primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: var(--theme-transition);
    transform: translateX(0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-inverse);
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(28px);
}

.theme-icon {
    position: absolute;
    font-size: 14px;
    opacity: 0.6;
    transition: var(--theme-transition);
    pointer-events: none;
}

.theme-icon.sun {
    left: 6px;
    color: var(--warning-color);
}

.theme-icon.moon {
    right: 6px;
    color: var(--accent-primary);
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0.4;
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    color: var(--text-inverse);
}

/* ========================================
   SMOOTH THEME TRANSITIONS
   ======================================== */

.theme-transitions-enabled * {
    transition: background-color 0.3s ease,
               color 0.3s ease,
               border-color 0.3s ease,
               box-shadow 0.3s ease !important;
}

/* ========================================
   PWA MODE ENHANCEMENTS
   ======================================== */

.pwa-mode {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.pwa-mode .header {
    padding-top: calc(60px + env(safe-area-inset-top));
}

/* ========================================
   OFFLINE MODE STYLES
   ======================================== */

.offline-mode {
    filter: grayscale(0.3);
}

.offline-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffc107, #ff6b6b);
    z-index: 9999;
    animation: offline-pulse 2s ease-in-out infinite;
}

/* ========================================
   MOBILE THEME TOGGLE
   ======================================== */

@media (max-width: 768px) {
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 55px;
        height: 28px;
    }

    .theme-toggle-slider {
        width: 22px;
        height: 22px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(25px);
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 50px;
        height: 26px;
    }

    .theme-toggle-slider {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(22px);
    }

    .theme-icon {
        font-size: 12px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .theme-toggle {
        border: 3px solid var(--text-primary);
    }

    .theme-toggle-slider {
        background: var(--text-primary) !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .theme-toggle-slider,
    .theme-icon {
        transition: none !important;
    }

    .theme-transitions-enabled * {
        transition: none !important;
    }
}
