/**
 * Theme Switcher Component Styles
 * Изолированные стили для переключателя темы
 * Namespace: .theme-switcher-component
 */

/* ===== ПЕРЕМЕННЫЕ ТЕМЫ ===== */
:root {
    /* Светлая тема (по умолчанию) */
    --theme-switcher-bg-primary: #ffffff;
    --theme-switcher-bg-secondary: #f8f9fa;
    --theme-switcher-bg-tertiary: #e9ecef;
    --theme-switcher-text-primary: #212529;
    --theme-switcher-text-secondary: #6c757d;
    --theme-switcher-border-color: #dee2e6;
    --theme-switcher-shadow-light: rgba(0, 0, 0, 0.1);
    --theme-switcher-accent-color: #007bff;
    --theme-switcher-accent-hover: #0056b3;
    
    /* Переходы */
    --theme-switcher-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Тёмная тема */
.dark-theme {
    --theme-switcher-bg-primary: #1a1a1a;
    --theme-switcher-bg-secondary: #2d2d2d;
    --theme-switcher-bg-tertiary: #404040;
    --theme-switcher-text-primary: #ffffff;
    --theme-switcher-text-secondary: #b3b3b3;
    --theme-switcher-border-color: #404040;
    --theme-switcher-shadow-light: rgba(255, 255, 255, 0.1);
    --theme-switcher-accent-color: #4dabf7;
    --theme-switcher-accent-hover: #339af0;
}

/* ===== КОМПОНЕНТ ПЕРЕКЛЮЧАТЕЛЯ ТЕМЫ ===== */
.theme-switcher-component {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Кнопка переключения темы */
.theme-switcher-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--theme-switcher-border-color);
    background: var(--theme-switcher-bg-secondary);
    color: var(--theme-switcher-text-primary);
    cursor: pointer;
    transition: var(--theme-switcher-transition);
    font-size: 18px;
    outline: none;
    overflow: hidden;
    text-decoration: none;
}

.theme-switcher-btn:hover {
    background: var(--theme-switcher-bg-tertiary);
    border-color: var(--theme-switcher-accent-color);
    transform: scale(1.05);
}

.theme-switcher-btn:focus {
    box-shadow: 0 0 0 3px var(--theme-switcher-accent-color);
    border-color: var(--theme-switcher-accent-color);
}

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

/* Иконки темы */
.theme-switcher-icon {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: var(--theme-switcher-transition);
    font-size: 18px;
}

/* Стили для иконок солнца и луны */
.theme-switcher-icon.sun-icon,
.theme-switcher-icon.light-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-switcher-icon.moon-icon,
.theme-switcher-icon.dark-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0.5);
}

/* Тёмная тема - показываем луну, скрываем солнце */
.dark-theme .theme-switcher-icon.sun-icon,
.dark-theme .theme-switcher-icon.light-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
}

.dark-theme .theme-switcher-icon.moon-icon,
.dark-theme .theme-switcher-icon.dark-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== СОСТОЯНИЯ КОМПОНЕНТА ===== */
.theme-switcher-component.loading .theme-switcher-btn {
    opacity: 0.7;
    pointer-events: none;
}

.theme-switcher-component.error .theme-switcher-btn {
    opacity: 0.5;
    border-color: #dc3545;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .theme-switcher-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .theme-switcher-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes themeSwitcherPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.theme-switcher-component.loading .theme-switcher-btn {
    animation: themeSwitcherPulse 1s infinite;
}

@keyframes themeSwitcherRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.theme-switcher-btn.rotating .theme-switcher-icon {
    animation: themeSwitcherRotate 0.5s ease-in-out;
}

/* ===== ДОСТУПНОСТЬ ===== */
/* Высокий контраст */
@media (prefers-contrast: high) {
    .theme-switcher-btn {
        border-width: 3px;
    }
}

/* Уменьшенная анимация */
@media (prefers-reduced-motion: reduce) {
    .theme-switcher-btn,
    .theme-switcher-icon {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== ИНТЕГРАЦИЯ С ГЛОБАЛЬНЫМИ СТИЛЯМИ ===== */
/* Применение темы к основным элементам */
body {
    background-color: var(--theme-switcher-bg-primary);
    color: var(--theme-switcher-text-primary);
    transition: var(--theme-switcher-transition);
}

/* Плавный переход при переключении темы */
body,
body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ===== СОВМЕСТИМОСТЬ С LEGACY КЛАССАМИ ===== */
/* Поддержка старых классов для обратной совместимости */
.service-theme-switcher {
    @extend .theme-switcher-btn;
}

.dark-theme-toggle {
    @extend .theme-switcher-btn;
}

/* Если CSS не поддерживает @extend, используем копирование стилей
.service-theme-switcher,
.dark-theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--theme-switcher-border-color);
    background: var(--theme-switcher-bg-secondary);
    color: var(--theme-switcher-text-primary);
    cursor: pointer;
    transition: var(--theme-switcher-transition);
    font-size: 18px;
    outline: none;
    overflow: hidden;
} */

.service-theme-switcher:hover,
.dark-theme-toggle:hover {
    background: var(--theme-switcher-bg-tertiary);
    border-color: var(--theme-switcher-accent-color);
    transform: scale(1.05);
}

.service-theme-switcher:focus,
.dark-theme-toggle:focus {
    box-shadow: 0 0 0 3px var(--theme-switcher-accent-color);
    border-color: var(--theme-switcher-accent-color);
}

.service-theme-switcher:active,
.dark-theme-toggle:active {
    transform: scale(0.95);
} 