/* ==============================
   سیستم تنظیمات - استایل‌های کامل
   نسخه بهینه‌شده و مستقل
   ============================== */

@import url('fonts.css');
@import url('variables.css');

/* استایل‌های مودال تنظیمات */
.settings-modal-content {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bg-accent);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h4 {
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-section h4::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 2px solid var(--bg-accent);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: var(--bg-secondary);
}

.theme-option:hover {
    border-color: var(--primary-color);
    background: rgba(212, 175, 55, 0.08);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-option:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.theme-checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    margin-left: 1rem;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.theme-option input[type="radio"]:checked + .theme-checkmark {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.theme-option input[type="radio"]:checked + .theme-checkmark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 50%;
}

.theme-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    flex: 1;
    font-size: 0.95rem;
}

.theme-label i {
    color: var(--primary-color);
    width: 18px;
    text-align: center;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-option:hover .theme-label i {
    transform: scale(1.1);
}

.theme-option input[type="radio"]:checked ~ .theme-label {
    color: var(--primary-color);
}

.theme-option input[type="radio"]:checked ~ .theme-label i {
    color: var(--primary-color);
    filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.3));
}

/* Font Switcher */
.font-switcher {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid var(--bg-accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: var(--bg-secondary);
}

.font-option:hover {
    border-color: var(--primary-color);
    background: rgba(212, 175, 55, 0.05);
}

.font-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.font-checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    margin-left: 0.75rem;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.font-option input[type="radio"]:checked + .font-checkmark {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.font-option input[type="radio"]:checked + .font-checkmark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.font-label {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    font-size: 0.95rem;
}

/* حالت‌های تم */
[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-accent: #E2E8F0;
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
}

[data-theme="dark"] {
    --bg-primary: #1A202C;
    --bg-secondary: #2D3748;
    --bg-accent: #4A5568;
    --text-primary: #FFFFFF;
    --text-secondary: #CBD5E0;
    --text-muted: #718096;
}

/* کلاس‌های فونت برای المان html - فقط فونت‌های موجود */
[data-font="vazirmatn"] {
    font-family: 'Vazirmatn', Tahoma, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-font="tahoma"] {
    font-family: Tahoma, 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-font="segoe-ui"] {
    font-family: 'Segoe UI', 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-font="system"] {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Vazirmatn', sans-serif;
}

/* بقیه استایل‌ها بدون تغییر... */

/* پشتیبانی از کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    .theme-option,
    .theme-label i,
    .font-option {
        transition: none;
    }
    
    .theme-option:hover {
        transform: none;
    }
}

/* پشتیبانی از کنتراست بالا */
@media (prefers-contrast: high) {
    .theme-option,
    .font-option {
        border-width: 3px;
    }
    
    .theme-checkmark,
    .font-checkmark {
        border-width: 3px;
    }
}

/* حالت تمرکز برای دسترسی‌پذیری */
.theme-option:focus-within,
.font-option:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ریسپانسیو - تبلت */
@media (max-width: 1024px) {
    .settings-modal-content {
        padding: 0.875rem;
        max-height: 65vh;
    }
    
    .settings-section {
        margin-bottom: 1.75rem;
        padding-bottom: 1.25rem;
    }
    
    .settings-section h4 {
        font-size: 1.05rem;
        margin-bottom: 1.1rem;
    }
    
    .theme-option {
        padding: 0.875rem 1.1rem;
    }
    
    .theme-label {
        font-size: 0.925rem;
        gap: 0.625rem;
    }
    
    .theme-label i {
        font-size: 1.05rem;
        width: 16px;
    }
    
    .font-option {
        padding: 0.7rem 0.9rem;
    }
    
    .font-label {
        font-size: 0.9rem;
    }
}

/* ریسپانسیو - موبایل */
@media (max-width: 768px) {
    .settings-modal-content {
        padding: 0.75rem;
        max-height: 70vh;
    }
    
    .settings-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .settings-section h4 {
        font-size: 1rem;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }
    
    .settings-section h4::before {
        height: 1.1rem;
    }
    
    .theme-switcher,
    .font-switcher {
        gap: 0.625rem;
    }
    
    .theme-option {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md);
    }
    
    .theme-checkmark {
        width: 18px;
        height: 18px;
        margin-left: 0.75rem;
    }
    
    .theme-label {
        font-size: 0.9rem;
        gap: 0.5rem;
    }
    
    .theme-label i {
        font-size: 1rem;
        width: 15px;
    }
    
    .font-option {
        padding: 0.65rem 0.85rem;
    }
    
    .font-checkmark {
        width: 16px;
        height: 16px;
        margin-left: 0.65rem;
    }
    
    .font-label {
        font-size: 0.85rem;
    }
}

/* ریسپانسیو - صفحات کوچک */
@media (max-width: 480px) {
    .settings-modal-content {
        padding: 0.625rem;
        max-height: 75vh;
    }
    
    .settings-section {
        margin-bottom: 1.25rem;
        padding-bottom: 0.875rem;
    }
    
    .settings-section h4 {
        font-size: 0.95rem;
        margin-bottom: 0.875rem;
    }
    
    .theme-switcher,
    .font-switcher {
        gap: 0.5rem;
    }
    
    .theme-option {
        padding: 0.625rem 0.75rem;
    }
    
    .theme-checkmark {
        width: 16px;
        height: 16px;
        margin-left: 0.625rem;
    }
    
    .theme-option input[type="radio"]:checked + .theme-checkmark::after {
        width: 6px;
        height: 6px;
    }
    
    .theme-label {
        font-size: 0.85rem;
        gap: 0.375rem;
    }
    
    .theme-label i {
        font-size: 0.9rem;
        width: 14px;
    }
    
    .font-option {
        padding: 0.55rem 0.7rem;
    }
    
    .font-checkmark {
        width: 15px;
        height: 15px;
        margin-left: 0.55rem;
    }
    
    .font-label {
        font-size: 0.8rem;
    }
}

/* پشتیبانی از دستگاه‌های لمسی */
@media (hover: none) and (pointer: coarse) {
    .theme-option:hover,
    .font-option:hover {
        transform: none;
        border-color: var(--bg-accent);
        background: var(--bg-secondary);
        box-shadow: none;
    }
    
    .theme-option:active,
    .font-option:active {
        background: rgba(212, 175, 55, 0.12);
        border-color: var(--primary-color);
        transform: scale(0.98);
    }
    
    .theme-option:hover .theme-label i {
        transform: none;
    }
}

/* جلوگیری از highlight آبی در موبایل */
.theme-option,
.theme-checkmark,
.theme-label,
.font-option,
.font-checkmark,
.font-label {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* اسکرول بار سفارشی برای مودال */
.settings-modal-content::-webkit-scrollbar {
    width: 6px;
}

.settings-modal-content::-webkit-scrollbar-track {
    background: var(--bg-accent);
    border-radius: 3px;
}

.settings-modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.settings-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* انیمیشن برای تغییر تم و فونت */
.theme-transition *,
.font-transition * {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, font-family 0.3s ease;
}

/* بهبودهای ظاهری برای فوتر */
#settingsBtn {
    position: relative;
    transition: all 0.3s ease;
}

#settingsBtn:hover {
    color: var(--primary-color);
}

#settingsBtn:active {
    transform: scale(0.95);
}

/* تضمین سازگاری با حالت‌های مختلف نمایش */
.socials-modal .settings-modal-content {
    animation: fadeInUp 0.3s ease-out;
}

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

/* بهبود دسترسی‌پذیری برای screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* استایل برای focus visible */
.theme-option:focus-visible,
.font-option:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
