/* ============================================
   SETTINGS PANEL (Monkeytype Style)
   ============================================ */

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e5e5e5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 999;
    font-size: 10px;
}

.settings-btn:hover {
    background: var(--bg, #fafafa);
    transform: rotate(90deg);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.settings-modal.open {
    display: flex;
}

.settings-panel {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Settings Header */
.settings-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #e5e5e5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--surface, #ffffff);
    z-index: 1;
}

.settings-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text, #1a1a1a);
}

.settings-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted, #737373);
    font-size: 20px;
    transition: all 0.2s;
}

.settings-close:hover {
    background: var(--bg, #fafafa);
    color: var(--text, #1a1a1a);
}

/* Settings Content */
.settings-content {
    padding: 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1a1a1a);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Setting Item */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border, #e5e5e5);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.setting-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text, #1a1a1a);
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted, #737373);
    line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border, #e5e5e5);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: var(--accent, #2563eb);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(20px);
}

/* Select Dropdown */
.setting-select {
    padding: 8px 12px;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 6px;
    background: var(--surface, #ffffff);
    color: var(--text, #1a1a1a);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.setting-select:hover {
    border-color: var(--accent, #2563eb);
}

.setting-select:focus {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
}

/* Number Input */
.setting-number {
    padding: 8px 12px;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 6px;
    background: var(--surface, #ffffff);
    color: var(--text, #1a1a1a);
    font-size: 13px;
    font-family: inherit;
    width: 80px;
    text-align: center;
    transition: all 0.2s;
}

.setting-number:hover {
    border-color: var(--accent, #2563eb);
}

.setting-number:focus {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
}

/* Color Picker */
.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--text, #1a1a1a);
}

.color-option.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.group-btn {
    padding: 8px 16px;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 6px;
    background: transparent;
    color: var(--text, #1a1a1a);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.group-btn:hover {
    background: var(--bg, #fafafa);
}

.group-btn.active {
    background: var(--accent, #2563eb);
    color: white;
    border-color: var(--accent, #2563eb);
}

/* Reset Button */
.reset-settings {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 8px;
    color: var(--text-muted, #737373);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-top: 16px;
}

.reset-settings:hover {
    background: var(--bg, #fafafa);
    color: var(--text, #1a1a1a);
    border-color: var(--text, #1a1a1a);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-track {
    background: transparent;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: var(--border, #e5e5e5);
    border-radius: 4px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #737373);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .settings-modal {
        background: rgba(0, 0, 0, 0.7);
    }

    .settings-panel {
        background: #1a1a1a;
        border-color: #262626;
    }

    .settings-header {
        background: #1a1a1a;
        border-color: #262626;
    }

    .setting-item {
        border-color: #262626;
    }

    .toggle-switch {
        background: #262626;
    }

    .setting-select,
    .setting-number {
        background: #1a1a1a;
        border-color: #262626;
    }

    .group-btn {
        border-color: #262626;
    }

    .group-btn:hover {
        background: #0a0a0a;
    }

    .reset-settings {
        border-color: #262626;
    }

    .reset-settings:hover {
        background: #0a0a0a;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .settings-panel {
        width: 95%;
        max-height: 90vh;
    }

    .settings-header {
        padding: 16px 20px;
    }

    .settings-content {
        padding: 20px;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .setting-select,
    .setting-number {
        width: 100%;
    }
}

/* New Elements Styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-link-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 6px;
    color: var(--text, #1a1a1a);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.profile-link-btn:hover {
    background: var(--bg, #fafafa);
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
}

.setting-range {
    width: 120px;
    accent-color: var(--accent, #2563eb);
}

.danger-btn {
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: #ef4444;
    color: white;
}