/* =========================================
   SETTINGS MODAL - WEBCONFIG (OPTIMIZED & COMPACT)
   ========================================= */

:root {
    --primary-color: #ff4757;
    --text-color: #f0f0f0;
    --background-dark: rgba(25, 25, 35, 0.98);
    --background-light: rgba(35, 35, 45, 0.98);
}

/* Modal Overlay */
.settings-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.settings-modal-overlay.open {
    display: flex;
    opacity: 1;
}

/* Modal Content Box - KOMPAKTER */
.settings-modal-content {
    position: relative;
    background: linear-gradient(145deg, var(--background-dark), var(--background-light));
    padding: 30px 35px;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    max-width: 580px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1);
    color: var(--text-color);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-40px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close Button - KLEINER */
.settings-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: linear-gradient(135deg, var(--primary-color), color-mix(in srgb, var(--primary-color) 80%, black));
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
    font-family: Arial, sans-serif;
    font-weight: 300;
    box-shadow: 
        0 4px 12px color-mix(in srgb, var(--primary-color) 40%, black),
        0 0 0 2px rgba(255, 255, 255, 0.1);
}

.settings-modal-close:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 90%, white), var(--primary-color));
    transform: scale(1.05) rotate(3deg);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary-color) 60%, black);
}

.settings-modal-close i {
    font-size: 18px;
}

/* Scrollbar Styling */
.settings-modal-content::-webkit-scrollbar {
    width: 8px;
}

.settings-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    margin: 10px 0;
}

.settings-modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.settings-modal-content::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--primary-color) 80%, black);
    background-clip: padding-box;
}

/* =========================================
   CONTENT STYLES & LAYOUT - KOMPAKT
   ========================================= */

.settings-header {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.settings-divider {
    border: none;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 28px 0;
}

.settings-section {
    margin-bottom: 28px;
}

.section-title-icon {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-top: 3px;
    display: flex;
    align-items: center;
}

.section-title-icon i {
    margin-right: 8px;
    font-size: 1.1em;
}

.section-description {
    font-size: 0.85rem;
    color: #bbb;
    line-height: 1.4;
    margin-bottom: 18px;
}

/* --- Language Selector - KOMPAKTER --- */
.language-selector {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.flag-option {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    font-weight: 500;
    text-align: center;
    flex: 1;
    min-height: 50px;
}

.flag-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.flag-option.active {
    border-color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.flag-icon {
    line-height: 1.8rem;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.flag-svg {
    width: 24px;
    height: 17px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.flag-text {
    font-size: 0.95rem;
    line-height: 1rem;
    display: inline-block;
    vertical-align: middle;
}

/* --- Background Picker - GRÖSSER & BESSER VERTEILT --- */
.color-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
    margin-bottom: 5px;
    align-items: center;
    justify-content: space-between;
}

.background-option {
    --bg-preview: #121212;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-preview);
    border: 3px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    flex-shrink: 0;
}

.background-option:hover {
    transform: scale(1.12);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.background-option.active {
    border-color: var(--primary-color);
    transform: scale(1.22);
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.3), 
        0 0 0 5px color-mix(in srgb, var(--primary-color) 40%, transparent);
}

.background-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.9));
    font-size: 20px;
}

/* --- Keyboard Shortcuts Section - NEU --- */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
    transition: all 0.3s ease;
}

.shortcut-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.shortcut-key {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    min-width: 60px;
    text-align: center;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-right: 10px;
    flex-shrink: 0;
}

.shortcut-description {
    font-size: 0.82rem;
    color: #ccc;
    line-height: 1.3;
}

/* --- Save Settings Button - NEU --- */
.save-settings-container {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-buttons-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.save-settings-btn,
.reset-settings-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), color-mix(in srgb, var(--primary-color) 80%, black));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 4px 12px color-mix(in srgb, var(--primary-color) 40%, black),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-settings-btn {
    background: linear-gradient(135deg, #666, #555);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.save-settings-btn:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 90%, white), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary-color) 60%, black);
}

.reset-settings-btn:hover {
    background: linear-gradient(135deg, #777, #666);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.save-settings-btn:active,
.reset-settings-btn:active {
    transform: translateY(0);
}

.save-settings-btn.success,
.reset-settings-btn.success {
    background: linear-gradient(135deg, #28a745, #218838);
}

.save-settings-btn i,
.reset-settings-btn i {
    font-size: 1rem;
}

.cookie-notice {
    font-size: 0.75rem;
    color: #999;
    text-align: center;
    margin-top: 10px;
    line-height: 1.4;
}

/* =========================================
   RESPONSIVE DESIGN (Mobile)
   ========================================= */
@media (max-width: 768px) {
    .settings-modal-content {
        padding: 25px 20px;
        max-width: 95%;
        max-height: 92vh;
        border-radius: 12px;
    }
    
    .settings-modal-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .settings-header {
        font-size: 1.5rem;
        margin-bottom: 18px;
        padding-bottom: 10px;
    }
    
    .settings-divider {
        margin: 18px 0;
    }
    
    .settings-section {
        margin-bottom: 18px;
    }
    
    .section-title-icon {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    
    .section-description {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .language-selector {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    
    .flag-option {
        max-width: 100%;
        min-height: 48px;
        padding: 10px 12px;
    }
    
    .flag-icon {
        margin-right: 8px;
    }
    
    .flag-svg {
        width: 22px;
        height: 15px;
    }
    
    .flag-text {
        font-size: 0.9rem;
    }
    
    .color-picker {
        gap: 12px;
        margin-top: 14px;
        justify-content: space-between;
    }
    
    .background-option {
        width: 52px;
        height: 52px;
    }
    
    .background-option.active {
        transform: scale(1.18);
    }
    
    .background-option.active::after {
        font-size: 18px;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 10px;
    }
    
    .shortcut-item {
        padding: 8px 10px;
    }
    
    .shortcut-key {
        font-size: 0.75rem;
        padding: 4px 8px;
        min-width: 55px;
        margin-right: 8px;
    }
    
    .shortcut-description {
        font-size: 0.78rem;
    }
    
    .save-settings-container {
        margin-top: 20px;
        padding-top: 18px;
    }
    
    .settings-buttons-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .save-settings-btn,
    .reset-settings-btn {
        padding: 11px 18px;
        font-size: 0.95rem;
    }
    
    .cookie-notice {
        font-size: 0.72rem;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .settings-modal-content {
        padding: 20px 16px;
        max-width: 96%;
        border-radius: 10px;
    }
    
    .settings-modal-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .settings-header {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .settings-section {
        margin-bottom: 15px;
    }
    
    .section-title-icon {
        font-size: 0.95rem;
    }
    
    .section-description {
        font-size: 0.75rem;
    }
    
    .flag-option {
        min-height: 45px;
        padding: 8px 10px;
    }
    
    .flag-svg {
        width: 20px;
        height: 14px;
    }
    
    .flag-text {
        font-size: 0.85rem;
    }
    
    .color-picker {
        gap: 10px;
    }
    
    .background-option {
        width: 48px;
        height: 48px;
    }
    
    .background-option.active::after {
        font-size: 16px;
    }
    
    .shortcut-key {
        font-size: 0.7rem;
        padding: 3px 6px;
        min-width: 50px;
    }
    
    .shortcut-description {
        font-size: 0.75rem;
    }
    
    .save-settings-btn,
    .reset-settings-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Landscape-Modus für kleine Bildschirme */
@media (max-width: 768px) and (orientation: landscape) {
    .settings-modal-content {
        max-height: 95vh;
        padding: 18px 22px;
    }
    
    .settings-header {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .settings-divider {
        margin: 15px 0;
    }
    
    .settings-section {
        margin-bottom: 15px;
    }
    
    .language-selector {
        flex-direction: row;
        gap: 12px;
    }
    
    .flag-option {
        min-height: 45px;
    }
    
    .shortcuts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}