/* ===== PERFORMANCE TOGGLE STYLES ===== */
/* Toggle for enabling/disabling animations for better performance */

/* Container for the toggle in the auth modal */
.performance-toggle-container {
    margin: 16px 0 8px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

/* Toggle Label */
.performance-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

/* Hide the default checkbox */
.performance-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* iOS-style Toggle Switch */
.toggle-slider {
    width: 48px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

/* Toggle Circle/Knob */
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checked State */
input[type="checkbox"]:checked + .toggle-slider {
    background: #4ade80;
    border-color: #4ade80;
}

input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Hover Effect */
.performance-toggle-label:hover .toggle-slider {
    border-color: rgba(255, 255, 255, 0.3);
}

input[type="checkbox"]:checked + .toggle-slider:hover {
    background: #22c55e;
}

/* Toggle Text with Icon */
.toggle-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    flex: 1;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    color: #fbbf24;
    stroke-width: 2;
}

/* Hint Text */
.toggle-hint {
    margin: 8px 0 0 60px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.4;
}

/* ===== GLOBAL ANIMATION DISABLE CLASS ===== */
/* When applied to body, disables all expensive animations */

body.animations-disabled *,
body.animations-disabled *::before,
body.animations-disabled *::after {
    /* Disable all animations */
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    
    /* Reduce transitions to minimal (not completely off to avoid jarring UX) */
    transition-duration: 0.1s !important;
}

/* Keep some critical UI transitions smooth for better UX */
body.animations-disabled .modal-overlay,
body.animations-disabled .modal-content,
body.animations-disabled .wp-button,
body.animations-disabled button {
    transition-duration: 0.2s !important;
}

/* Disable transforms on background elements */
body.animations-disabled .wp-molino,
body.animations-disabled .wp-particles,
body.animations-disabled .wp-grain {
    animation: none !important;
    transform: none !important;
}

/* Disable particle effects */
body.animations-disabled .wp-particles::before {
    animation: none !important;
}

/* Simplify card hover effects */
body.animations-disabled .wp-card-premium:hover {
    transform: translateY(-5px) !important;
}

/* ===== RESPECT SYSTEM PREFERENCES ===== */
/* Automatically disable animations if user has reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    body *,
    body *::before,
    body *::after {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
    }
    
    .wp-molino,
    .wp-particles,
    .wp-grain {
        animation: none !important;
    }
}

/* ===== ACCESSIBILITY ===== */
/* Focus state for keyboard navigation */
.performance-toggle-label:focus-within .toggle-slider {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Active state for touch feedback */
.performance-toggle-label:active .toggle-slider::before {
    transform: scale(0.95) translateX(0);
}

input[type="checkbox"]:checked + .toggle-slider:active::before {
    transform: scale(0.95) translateX(22px);
}
