/* ==========================================
   SETTINGS PAGE
   ========================================== */

/* Settings Layout */
.settings-container {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-lg) 0;
}

/* Section */
.settings-section {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.settings-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-glass-border);
}

.settings-section-title i {
    color: var(--color-primary);
    font-size: 1.2rem;
}

/* Setting Row */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 0.78rem;
    color: var(--color-text-dim);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* Select Dropdown */
.setting-select {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.85rem;
    font-family: var(--font-family-primary);
    cursor: pointer;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8a8a' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

[dir="rtl"] .setting-select {
    padding-right: var(--space-md);
    padding-left: 32px;
    background-position: left 12px center;
}

.setting-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Profile Section */
.profile-card {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.profile-details h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-details p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.profile-edit-btn {
    margin-left: auto;
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

[dir="rtl"] .profile-edit-btn {
    margin-left: 0;
    margin-right: auto;
}

.profile-edit-btn:hover {
    background: var(--color-primary-hover);
    color: white;
    box-shadow: var(--shadow-glow-primary);
}

/* Danger Zone */
.danger-section {
    border-color: rgba(239, 68, 68, 0.2);
}

.danger-section .settings-section-title {
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.danger-section .settings-section-title i {
    color: #ef4444;
}

.danger-btn {
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: 1px solid #ef4444;
    border-radius: var(--radius-md);
    color: #ef4444;
    font-size: 0.85rem;
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: #ef4444;
    color: white;
}

/* Background Style Picker */
.bg-style-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bg-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: var(--color-glass);
    border: 2px solid var(--color-glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 70px;
    font-family: var(--font-family-primary);
}

.bg-tile:hover {
    border-color: var(--color-text-muted);
    transform: translateY(-2px);
}

.bg-tile.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-glow-primary);
}

.bg-tile-preview {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg);
    position: relative;
}

/* Mini preview patterns */
.bg-preview-grid {
    background-image:
        linear-gradient(var(--color-glass-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-glass-border) 1px, transparent 1px);
    background-size: 12px 12px;
}

.bg-preview-doodle {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Ctext x='5' y='15' font-size='10' opacity='0.2'%3E📚%3C/text%3E%3Ctext x='35' y='30' font-size='8' opacity='0.15'%3E✏️%3C/text%3E%3Ctext x='15' y='50' font-size='10' opacity='0.18'%3E💡%3C/text%3E%3C/svg%3E");
    background-size: 60px 60px;
}

.bg-preview-minimal {
    background-image: radial-gradient(circle, var(--color-text-muted) 0.8px, transparent 0.8px);
    background-size: 8px 8px;
    opacity: 0.6;
}

.bg-preview-classic {
    background-image: repeating-linear-gradient(-45deg,
            transparent,
            transparent 4px,
            var(--color-glass-border) 4px,
            var(--color-glass-border) 5px);
}

.bg-preview-aurora {
    background: linear-gradient(135deg,
            rgba(45, 184, 76, 0.3) 0%,
            rgba(74, 144, 217, 0.2) 40%,
            rgba(245, 166, 35, 0.25) 80%,
            rgba(255, 107, 53, 0.15) 100%);
}

.bg-tile-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
    transition: color 0.3s ease;
}

.bg-tile.active .bg-tile-label {
    color: var(--color-primary);
    font-weight: 600;
}

/* Light Mode */
html[data-theme="light"] .settings-section {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .profile-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .toggle-slider {
    background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .setting-row {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}