/* ═══════════════════════════════════════════════════════════
   Core Styles — مشاورمالی
   
   ترکیب:
   1. Reset
   2. تایپوگرافی پایه
   3. کلاس‌های کمکی قدیمی (backward compatibility)
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   ۱. Reset
   ═══════════════════════════════════════════════════════ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ═══════════════════════════════════════════════════════
   ۲. تیترها
   ═══════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin: 0 0 var(--space-4) 0;
}

h1 { font-size: var(--font-size-4xl); font-weight: var(--font-weight-black); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); }
h5 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
h6 { font-size: var(--font-size-md); font-weight: var(--font-weight-semibold); }

/* ═══════════════════════════════════════════════════════
   ۳. متن
   ═══════════════════════════════════════════════════════ */

p {
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    margin: 0 0 var(--space-4) 0;
}

p:last-child { margin-bottom: 0; }

strong, b { font-weight: var(--font-weight-bold); color: var(--text-primary); }

small { font-size: var(--font-size-sm); color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   ۴. لینک
   ═══════════════════════════════════════════════════════ */

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
    cursor: pointer;
}

a:hover { color: var(--text-link-hover); }

/* ═══════════════════════════════════════════════════════
   ۵. لیست
   ═══════════════════════════════════════════════════════ */

ul, ol {
    padding-right: var(--space-5);
    margin: 0 0 var(--space-4) 0;
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

ul { list-style: disc; }
ol { list-style: decimal; }
li { margin-bottom: var(--space-1); }

/* ═══════════════════════════════════════════════════════
   ۶. کد
   ═══════════════════════════════════════════════════════ */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-subtle);
    color: var(--brand-primary-light);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    direction: ltr;
    display: inline-block;
}

pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    background: var(--bg-subtle);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    border: 1px solid var(--border-default);
}

/* ═══════════════════════════════════════════════════════
   ۷. فرم (پایه)
   ═══════════════════════════════════════════════════════ */

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ═══════════════════════════════════════════════════════
   ۸. جدول (پایه)
   ═══════════════════════════════════════════════════════ */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

th {
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    text-align: right;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

td {
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════
   ۹. خط جداکننده
   ═══════════════════════════════════════════════════════ */

hr {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: var(--space-6) 0;
}

/* ═══════════════════════════════════════════════════════
   ۱۰. تصاویر
   ═══════════════════════════════════════════════════════ */

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ═══════════════════════════════════════════════════════
   ۱۱. اسکرول‌بار سفارشی
   ═══════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-subtle);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary);
}

/* ═══════════════════════════════════════════════════════
   ۱۲. انتخاب متن
   ═══════════════════════════════════════════════════════ */

::selection {
    background: var(--brand-primary);
    color: var(--text-inverse);
}

/* ═══════════════════════════════════════════════════════
   ۱۳. ⭐ کلاس‌های کمکی قدیمی (Backward Compatibility)
   این کلاس‌ها در کد قدیمی استفاده می‌شن. مقادیر عیناً حفظ شدن.
   ═══════════════════════════════════════════════════════ */

/* ─── Container قدیمی (1200px) ─── */
.container {
    max-width: 1200px;
    margin: auto;
    padding: 0 20px;
}

/* ─── Section قدیمی ─── */
.section {
    padding: 70px 0;
}

/* ─── Text Center ─── */
.text-center {
    text-align: center;
}

/* ─── Grid قدیمی ─── */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ─── دکمه قدیمی ─── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-primary-dark);
    color: white;
}

/* ═══════════════════════════════════════════════════════
   ۱۴. دسترس‌پذیری
   ═══════════════════════════════════════════════════════ */

.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 {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}