/**
 * Settings System CSS
 * Modern, accessible settings interface with smooth animations
 */

/* ==========================================================================
   Settings Container
   ========================================================================== */

.settings-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    height: 600px;
    margin: 0 auto;
    background: var(--modal-bg, rgba(30, 30, 50, 0.95));
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   Tab Navigation
   ========================================================================== */

.settings-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    min-width: 120px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.settings-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.settings-tab:focus {
    outline: 2px solid var(--focus-color, #4CAF50);
    outline-offset: -2px;
    z-index: 1;
}

.settings-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.tab-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
}

.settings-tab:hover .tab-icon {
    transform: scale(1.1);
}

.tab-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.tab-description {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
    line-height: 1.2;
}

/* ==========================================================================
   Settings Panels
   ========================================================================== */

.settings-panels {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: rgba(255, 255, 255, 0.02);
}

.settings-panel {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease-out;
}

.settings-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-panel h3 {
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Setting Groups
   ========================================================================== */

.setting-group {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.setting-group:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.setting-group:focus-within {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--focus-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* ==========================================================================
   Setting Labels
   ========================================================================== */

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
}

.setting-value {
    font-size: 12px;
    color: var(--accent-color, #4CAF50);
    font-weight: 600;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 40px;
    text-align: center;
}

.setting-description {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* ==========================================================================
   Sliders
   ========================================================================== */

.setting-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.setting-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.setting-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.setting-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.setting-slider:focus {
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

/* ==========================================================================
   Checkboxes
   ========================================================================== */

.setting-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    margin-bottom: 0;
    font-size: 14px;
    color: #ffffff;
    user-select: none;
}

.setting-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-right: 12px;
    transition: all 0.2s ease;
}

.setting-checkbox:hover .checkmark {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.setting-checkbox input:checked ~ .checkmark {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
}

.setting-checkbox input:focus ~ .checkmark {
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.setting-checkbox input:checked ~ .checkmark::after {
    display: block;
    animation: checkmark 0.2s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: rotate(45deg) scale(0);
    }
    50% {
        transform: rotate(45deg) scale(1.2);
    }
    100% {
        transform: rotate(45deg) scale(1);
    }
}

/* ==========================================================================
   Select Dropdowns
   ========================================================================== */

.setting-select {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.setting-select:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
}

.setting-select:focus {
    outline: none;
    border-color: var(--focus-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.setting-select option {
    background: #2a2a3a;
    color: #ffffff;
    padding: 8px;
}

/* ==========================================================================
   Theme Selector
   ========================================================================== */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.theme-option.selected {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.theme-option:focus {
    outline: none;
    border-color: var(--focus-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-preview-space {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f3c);
}

.theme-preview-forest {
    background: linear-gradient(135deg, #2d5016, #3d6b1f, #4a7c20);
}

.theme-preview-ocean {
    background: linear-gradient(135deg, #006994, #0891b2, #06b6d4);
}

.theme-preview-fire {
    background: linear-gradient(135deg, #dc2626, #ea580c, #f59e0b);
}

.theme-preview-celestial {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #c084fc);
}

.theme-name {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: #ffffff;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.settings-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 12px;
}

.settings-actions-right {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    white-space: nowrap;
}

.btn:focus {
    outline: 2px solid var(--focus-color, #4CAF50);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #45a049, #3e8e41);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .settings-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .settings-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .settings-tab {
        min-width: 100px;
        padding: 12px 16px;
    }
    
    .tab-label {
        font-size: 12px;
    }
    
    .tab-description {
        display: none;
    }
    
    .settings-panel {
        padding: 16px;
    }
    
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .settings-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .settings-actions-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .settings-tab {
        min-width: 80px;
        padding: 10px 8px;
    }
    
    .tab-icon {
        font-size: 20px;
    }
    
    .tab-label {
        font-size: 11px;
    }
    
    .setting-group {
        margin-bottom: 16px;
        padding: 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

.high-contrast .settings-container {
    background: #000000;
    border: 2px solid #ffffff;
}

.high-contrast .setting-group {
    background: #000000;
    border: 1px solid #ffffff;
}

.high-contrast .setting-slider {
    background: #ffffff;
}

.high-contrast .setting-slider::-webkit-slider-thumb {
    background: #ffff00;
    border: 2px solid #000000;
}

.high-contrast .checkmark {
    background: #000000;
    border: 2px solid #ffffff;
}

.high-contrast .setting-checkbox input:checked ~ .checkmark {
    background: #ffff00;
    border-color: #000000;
}

.high-contrast .theme-option {
    background: #000000;
    border: 2px solid #ffffff;
}

.high-contrast .theme-option.selected {
    background: #ffff00;
    color: #000000;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .settings-tab,
    .setting-group,
    .setting-slider,
    .checkmark,
    .theme-option,
    .btn {
        transition: none;
    }
    
    .settings-panel {
        animation: none;
    }
    
    .settings-tab.active::after {
        animation: none;
    }
    
    .checkmark::after {
        animation: none;
    }
}

.reduced-motion .settings-tab,
.reduced-motion .setting-group,
.reduced-motion .setting-slider,
.reduced-motion .checkmark,
.reduced-motion .theme-option,
.reduced-motion .btn {
    transition: none;
}

.reduced-motion .settings-panel {
    animation: none;
}

.reduced-motion .settings-tab.active::after {
    animation: none;
}

.reduced-motion .checkmark::after {
    animation: none;
}

/* ==========================================================================
   Large Text Mode
   ========================================================================== */

.large-text .settings-container {
    font-size: 18px;
}

.large-text .tab-label {
    font-size: 16px;
}

.large-text .tab-description {
    font-size: 13px;
}

.large-text .setting-label {
    font-size: 16px;
}

.large-text .setting-description {
    font-size: 14px;
}

.large-text .btn {
    font-size: 16px;
    padding: 12px 24px;
}

/* ==========================================================================
   Focus Indicators
   ========================================================================== */

.focus-indicators .settings-tab:focus,
.focus-indicators .setting-slider:focus,
.focus-indicators .setting-checkbox input:focus ~ .checkmark,
.focus-indicators .setting-select:focus,
.focus-indicators .theme-option:focus,
.focus-indicators .btn:focus {
    outline: 3px solid #ffff00;
    outline-offset: 2px;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

.settings-container {
    contain: layout style paint;
    will-change: transform;
}

.settings-panel {
    contain: layout style;
}

.hardware-accelerated .settings-tab,
.hardware-accelerated .setting-group,
.hardware-accelerated .theme-option {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ==========================================================================
   Dark Mode Adjustments
   ========================================================================== */

.dark-mode .settings-container {
    background: rgba(15, 15, 25, 0.98);
}

.dark-mode .setting-group {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .setting-select {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Keyboard Focus Indicators for Advanced Input System
   ========================================================================== */

.keyboard-focused {
    outline: 3px solid var(--focus-color, #4A9EFF) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3) !important;
}

/* Enhanced focus for high contrast mode */
@media (prefers-contrast: high) {
    .keyboard-focused {
        outline: 3px solid #FFFFFF !important;
        background-color: #000000 !important;
        color: #FFFFFF !important;
    }
}

/* Focus indicators for game board cells */
.gem.keyboard-focused {
    transform: scale(1.1) !important;
    z-index: 100 !important;
    border: 3px solid #FFD700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8) !important;
}

/* Screen reader only content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Live region for screen reader announcements */
#screen-reader-live-region {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
} 