/* Composants pour le système de thème */

/* Bouton de basculement de thème principal */
.theme-toggle {
    position: relative;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: var(--button-bg-secondary);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

.theme-toggle i {
    font-size: 1.2rem;
    transition: var(--transition);
}

/* Bouton de thème avec texte */
.theme-toggle-with-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--button-bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-with-text:hover {
    background: var(--button-bg-secondary-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

/* Animation de rotation pour l'icône */
.theme-toggle.changing i {
    transform: rotate(180deg);
}

/* Indicateur de thème actuel */
.theme-indicator {
    position: relative;
}

.theme-indicator::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0;
    transition: var(--transition);
}

.theme-indicator.active::after {
    opacity: 1;
}

/* Widget de sélection de thème avancé */
.theme-selector {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.25rem;
    gap: 0.25rem;
}

.theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    background: none;
    border: none;
    min-width: 2.5rem;
}

.theme-option:hover {
    background: var(--button-bg-secondary);
    color: var(--text-primary);
}

.theme-option.active {
    background: var(--primary-color);
    color: white;
}

.theme-option i {
    font-size: 1.1rem;
}

/* Animation de changement de thème global */
@keyframes themeChange {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

html.theme-changing {
    animation: themeChange 0.3s ease;
}

/* Prévisualisation de thème */
.theme-preview {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.theme-preview-item {
    flex: 1;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.theme-preview-item.light {
    background: #ffffff;
    color: #1a202c;
    border-color: #e2e8f0;
}

.theme-preview-item.dark {
    background: #1e2935;
    color: #f7fafc;
    border-color: #374151;
}

.theme-preview-item:hover,
.theme-preview-item.active {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-preview-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.theme-preview-description {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Menu de thème dans le dropdown */
.theme-menu {
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.theme-menu-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .theme-toggle-with-text .theme-text {
        display: none;
    }
    
    .theme-preview {
        flex-direction: column;
    }
    
    .theme-selector {
        justify-content: center;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .theme-toggle {
        border: 2px solid var(--border-color);
    }
    
    .theme-option {
        border: 1px solid var(--border-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .theme-toggle i,
    .theme-option,
    .theme-preview-item {
        transition: none !important;
    }
    
    .theme-toggle.changing i {
        transform: none;
    }
    
    html.theme-changing {
        animation: none;
    }
}