/* ========================================
   ENHANCED THEME SWITCHER STYLES
   Mobile-responsive with animations
======================================== */

/* Theme Switcher Container */
.theme-switcher {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--border-color);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-switcher:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.theme-switcher:active {
    transform: scale(0.95);
}

/* Toggle Ball */
.theme-switcher::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--bg-color);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Theme Icons Container */
.theme-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    z-index: 1;
}

.theme-icon {
    font-size: 12px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.sun-icon {
    color: #ffa500;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.moon-icon {
    color: #4169e1;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Dark Theme Active State */
[data-theme="dark"] .theme-switcher {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

[data-theme="dark"] .theme-switcher::before {
    transform: translateX(24px);
    background-color: #fff;
}

[data-theme="dark"] .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* Light Theme Active State */
[data-theme="light"] .theme-switcher {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="light"] .theme-switcher::before {
    transform: translateX(0);
    background-color: var(--text-color);
}

/* Alternative Circular Theme Switcher */
.theme-switcher-circular {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-switcher-circular:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 4px 16px var(--shadow-color);
}

.theme-switcher-circular:active {
    transform: rotate(180deg) scale(0.95);
}

.theme-switcher-circular .theme-icon {
    font-size: 18px;
    transition: all 0.4s;
    position: absolute;
}

.theme-switcher-circular .sun-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
    color: #ffa500;
}

.theme-switcher-circular .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #4169e1;
}

[data-theme="dark"] .theme-switcher-circular {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3a7fee 100%);
    border-color: var(--accent-color);
}

[data-theme="dark"] .theme-switcher-circular .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-switcher-circular .moon-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Theme Switcher with Label */
.theme-switcher-with-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 25px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.theme-switcher-with-label:hover {
    background-color: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.theme-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    transition: color 0.3s;
    user-select: none;
}

/* Floating Theme Switcher */
.theme-switcher-floating {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid var(--bg-color);
    box-shadow: 0 4px 16px var(--shadow-color);
}

.theme-switcher-floating:hover {
    transform: translateY(-50%) scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px var(--shadow-color);
}

.theme-switcher-floating .theme-icon {
    font-size: 20px;
    color: white;
    transition: all 0.4s;
}

/* Theme Transition Animation */
.theme-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--accent-color) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transform: scale(0);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-transition.active {
    opacity: 0.3;
    transform: scale(2);
}

/* ========================================
   MOBILE RESPONSIVE STYLES
======================================== */

/* Mobile Devices (320px - 480px) */
@media screen and (max-width: 480px) {
    
    .theme-switcher {
        width: 45px;
        height: 22px;
    }
    
    .theme-switcher::before {
        width: 14px;
        height: 14px;
        top: 2px;
        left: 2px;
    }
    
    [data-theme="dark"] .theme-switcher::before {
        transform: translateX(21px);
    }
    
    .theme-icon {
        font-size: 10px;
        width: 14px;
        height: 14px;
    }
    
    .theme-switcher-circular {
        width: 38px;
        height: 38px;
    }
    
    .theme-switcher-circular .theme-icon {
        font-size: 16px;
    }
    
    .theme-switcher-with-label {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .theme-label {
        font-size: 12px;
    }
    
    .theme-switcher-floating {
        width: 44px;
        height: 44px;
        right: 15px;
        border-width: 2px;
    }
    
    .theme-switcher-floating .theme-icon {
        font-size: 18px;
    }
}

/* Small Tablets (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    
    .theme-switcher {
        width: 48px;
        height: 23px;
    }
    
    .theme-switcher::before {
        width: 15px;
        height: 15px;
    }
    
    [data-theme="dark"] .theme-switcher::before {
        transform: translateX(23px);
    }
    
    .theme-icon {
        font-size: 11px;
        width: 15px;
        height: 15px;
    }
    
    .theme-switcher-circular {
        width: 40px;
        height: 40px;
    }
    
    .theme-switcher-circular .theme-icon {
        font-size: 17px;
    }
    
    .theme-switcher-floating {
        width: 46px;
        height: 46px;
        right: 18px;
    }
    
    .theme-switcher-floating .theme-icon {
        font-size: 19px;
    }
}

/* Landscape Orientation */
@media screen and (max-height: 500px) and (orientation: landscape) {
    
    .theme-switcher-floating {
        top: 20px;
        transform: none;
        right: 15px;
    }
    
    .theme-switcher-floating:hover {
        transform: scale(1.1) rotate(15deg);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    
    .theme-switcher,
    .theme-switcher-circular,
    .theme-switcher-with-label,
    .theme-switcher-floating {
        min-height: 44px;
        min-width: 44px;
    }
    
    .theme-switcher:hover,
    .theme-switcher-circular:hover,
    .theme-switcher-with-label:hover,
    .theme-switcher-floating:hover {
        transform: none;
    }
    
    .theme-switcher:active,
    .theme-switcher-circular:active,
    .theme-switcher-with-label:active,
    .theme-switcher-floating:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* High DPI Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    
    .theme-switcher,
    .theme-switcher-circular,
    .theme-switcher-floating {
        border-width: 1px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    
    .theme-switcher,
    .theme-switcher::before,
    .theme-switcher-circular,
    .theme-switcher-floating,
    .theme-icon,
    .sun-icon,
    .moon-icon,
    .theme-transition {
        transition: none;
        animation: none;
    }
    
    .theme-switcher:hover,
    .theme-switcher-circular:hover,
    .theme-switcher-floating:hover {
        transform: none;
    }
}

/* Focus Styles for Accessibility */
.theme-switcher:focus,
.theme-switcher-circular:focus,
.theme-switcher-with-label:focus,
.theme-switcher-floating:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    
    .theme-switcher,
    .theme-switcher-circular,
    .theme-switcher-with-label,
    .theme-switcher-floating {
        border: 2px solid #000000;
    }
    
    .theme-icon {
        color: #000000;
    }
    
    [data-theme="dark"] .theme-icon {
        color: #ffffff;
    }
}

/* ========================================
   UTILITY CLASSES
======================================== */

/* Hide theme switcher on specific screens if needed */
.theme-switcher-hide-mobile {
    display: block;
}

@media screen and (max-width: 768px) {
    .theme-switcher-hide-mobile {
        display: none;
    }
}

.theme-switcher-mobile-only {
    display: none;
}

@media screen and (max-width: 768px) {
    .theme-switcher-mobile-only {
        display: flex;
    }
}

/* Animation Classes */
.theme-switcher-pulse {
    animation: theme-pulse 2s infinite;
}

@keyframes theme-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.theme-switcher-bounce {
    animation: theme-bounce 1s ease-in-out;
}

@keyframes theme-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}