/* ============================================================================
   THEME TOGGLE SWITCH - Modern Slider Style
   Shows current state and toggle direction with moon/sun icons
   ============================================================================ */

.theme-toggle {
    position: relative;
    width: 70px;
    height: 32px;
    background: var(--border-light);
    border: 2px solid var(--border-light);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.theme-toggle:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

/* Icons container */
.theme-toggle-icons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.theme-icon {
    font-size: 16px;
    line-height: 1;
    transition: all 0.3s ease;
    opacity: 0.5;
}

/* Moon icon (left side) - visible in light mode */
.theme-icon-moon {
    margin-left: 2px;
}

/* Sun icon (right side) - visible in dark mode */
.theme-icon-sun {
    margin-right: 2px;
}

/* The sliding circle */
.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Dark mode styles */
[data-theme="dark"] .theme-toggle {
    background: var(--border-light);
}

[data-theme="dark"] .theme-toggle:hover {
    background: var(--primary-blue);
}

[data-theme="dark"] .theme-toggle-slider {
    left: calc(100% - 25px);
    background: var(--dark-bg);
}

/* Highlight the active icon */
[data-theme="light"] .theme-icon-sun {
    opacity: 1;
}

[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
}

/* Hover effects */
.theme-toggle:hover .theme-icon {
    opacity: 1;
}

/* Focus state for accessibility */
.theme-toggle:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Animation on click */
.theme-toggle:active .theme-toggle-slider {
    width: 26px;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

/* Slightly larger on desktop */
@media (min-width: 1024px) {
    .theme-toggle {
        width: 75px;
        height: 34px;
    }
    
    .theme-toggle-slider {
        width: 24px;
        height: 24px;
    }
    
    [data-theme="dark"] .theme-toggle-slider {
        left: calc(100% - 27px);
    }
    
    .theme-icon {
        font-size: 17px;
    }
}

/* Smaller on mobile */
@media (max-width: 768px) {
    .theme-toggle {
        width: 65px;
        height: 30px;
    }
    
    .theme-toggle-slider {
        width: 20px;
        height: 20px;
        top: 3px;
    }
    
    [data-theme="dark"] .theme-toggle-slider {
        left: calc(100% - 23px);
    }
    
    .theme-icon {
        font-size: 15px;
    }
}

/* ============================================================================
   THEME TOGGLE IN NAVIGATION - Positioning & Responsive Styles
   Add this to your components.css or responsive-navigation.css
   ============================================================================ */

/* Position theme toggle in navigation */
.nav-theme-toggle {
    display: flex;
    align-items: center;
    margin-left: auto; /* Push to the right */
}

/* Remove default list styling */
.nav-theme-toggle {
    list-style: none;
}

/* Desktop: Theme toggle in navigation bar */
@media (min-width: 769px) {
    .nav-links {
        display: flex;
        align-items: center;
        gap: var(--spacing-2xl);
    }
    
    .nav-theme-toggle {
        margin-left: var(--spacing-lg);
    }
}

/* Mobile: Theme toggle in hamburger menu */
@media (max-width: 768px) {
    /* Theme toggle at bottom of mobile menu */
    .nav-theme-toggle {
        margin-top: var(--spacing-xl);
        padding-top: var(--spacing-lg);
        justify-content: center;
    }
    
    /* Center the toggle in mobile menu */
    .nav-theme-toggle .theme-toggle {
        margin: 0 auto;
    }
}

/* ============================================================================
   ALTERNATIVE: Theme Toggle in Header (for app page)
   ============================================================================ */

/* If you want theme toggle in app page header instead */
.header-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.header-controls .theme-toggle {
    margin-left: var(--spacing-md);
}

/* Mobile adjustments for header toggle */
@media (max-width: 768px) {
    .header-controls {
        gap: var(--spacing-md);
    }
    
    .header-controls .theme-toggle {
        margin-left: var(--spacing-sm);
    }
    
    /* Hide system status on very small screens */
    @media (max-width: 480px) {
        .system-status {
            display: none;
        }
    }
}

/* ============================================================================
   FLOATING THEME TOGGLE (Optional)
   Uncomment if you want a floating toggle in corner
   ============================================================================ */

/*
.floating-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .floating-theme-toggle {
        bottom: 15px;
        right: 15px;
    }
}
*/

/* ============================================================================
   ENSURE SMOOTH TRANSITIONS
   ============================================================================ */

/* Smooth theme transitions for all themed elements */
body,
.nav,
.header,
.footer,
.card,
.btn,
.form-input,
.form-select {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease;
}

/* Logo fade transition when changing themes */
#nav-logo,
#header-logo {
    transition: opacity 0.2s ease;
}

/* Prevent transition flash on page load */
body.no-transition * {
    transition: none !important;
}