/* =============================================
   Legal pages (شرایط استفاده / حریم خصوصی)
   ============================================= */
.legal-hero { background: #e0e5fd; padding: 20px 0 48px; }
.legal-hero h1 { font-size: 2.4rem; font-weight: 900; margin-bottom: 10px; }
.legal-hero p { font-size: 1.05rem; opacity: .88; max-width: 640px; margin: 0 auto; line-height: 1.9; }
.legal-hero .hero-crumbs { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; margin-bottom: 14px; opacity: .85; }
.legal-hero .hero-crumbs a { color: #fff; text-decoration: none; }
.legal-hero .hero-crumbs a:hover { text-decoration: underline; }
.legal-meta { display: flex; justify-content: center; gap: 10px 22px; flex-wrap: wrap; margin-top: 18px; font-size: .86rem; opacity: .92; }
.legal-meta span { background: rgba(255, 255, 255, 0.6); padding: 4px 14px; border-radius: 100px; }
.legal-tabs { display: inline-flex; gap: 6px; background: rgba(255, 255, 255, 0.5); padding: 5px; border-radius: 14px; margin-top: 24px; }
.legal-tabs a { color: #222; text-decoration: none; padding: 8px 22px; border-radius: 10px; font-weight: 700; font-size: .95rem; transition: var(--transition); }
.legal-tabs a:hover { background: rgba(255, 255, 255, .15); }
.legal-tabs a[aria-current="page"] { background: #4f46e5; color: white }
@media (max-width: 640px) { .legal-hero { padding: 44px 0 36px; } .legal-hero h1 { font-size: 1.7rem; } }

.legal-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 991px) { .legal-layout { grid-template-columns: 1fr; gap: 20px; } }

/* فهرست */
.legal-toc { position: sticky; top: 96px; }
@media (max-width: 991px) { .legal-toc { position: static; } }
.legal-toc-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 0 18px; }
.legal-toc-box summary { cursor: pointer; font-weight: 900; color: var(--text-heading); padding: 16px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.legal-toc-box summary::-webkit-details-marker { display: none; }
.legal-toc-box summary::after { content: "＋"; color: #94a3b8; }
.legal-toc-box[open] summary::after { content: "－"; }
.legal-toc-box ol { list-style: none; margin: 0; padding: 0 0 14px; max-height: calc(100vh - 220px); overflow-y: auto; }
.legal-toc-box li a { display: block; padding: 7px 10px; margin: 2px 0; border-radius: 10px; font-size: .88rem; line-height: 1.7; color: #475569; text-decoration: none; border-right: 3px solid transparent; transition: var(--transition); }
.legal-toc-box li a:hover { background: #f5f3ff; color: var(--brand-purple); }
.legal-toc-box li a.is-active { background: #f5f3ff; color: var(--brand-purple); border-right-color: var(--brand-purple); font-weight: 700; }
.legal-print { margin-top: 12px; width: 100%; padding: 10px; border: 1px dashed #cbd5e1; background: transparent; border-radius: 12px; color: #64748b; font-family: inherit; font-size: .85rem; cursor: pointer; }
.legal-print:hover { border-color: var(--brand-purple); color: var(--brand-purple); }

/* متن */
.legal-content { background: #fff; border: 1px solid #e2e8f0; border-radius: 24px; padding: 40px 44px; font-size: 1rem; line-height: 2; color: #475569; overflow-wrap: anywhere; }
@media (max-width: 640px) { .legal-content { padding: 24px 18px; border-radius: 18px; } }
.legal-content h2 { position: relative; font-size: 1.35rem; font-weight: 800; color: var(--text-heading); margin: 40px 0 14px; padding-bottom: 10px; border-bottom: 2px solid #f1f5f9; line-height: 1.7; scroll-margin-top: 100px; }
.legal-content > .legal-summary + h2 { margin-top: 28px; }
.legal-content h3 { font-size: 1.08rem; font-weight: 700; color: var(--text-heading); margin: 24px 0 8px; scroll-margin-top: 100px; }
.legal-content p { margin: 0 0 14px; }
.legal-content ul, .legal-content ol { margin: 0 0 16px; padding-inline-start: 1.6em; }
.legal-content ul { list-style: disc; } .legal-content ol { list-style: decimal; }
.legal-content li { margin-bottom: 6px; }
.legal-content li::marker { color: var(--brand-purple); }
.legal-content strong { font-weight: 900; color: var(--text-heading); }
.legal-content a { color: var(--brand-purple); text-underline-offset: 3px; }
.legal-content a:hover { color: var(--brand-purple-dark, #4f46e5); }
.legal-anchor { position: absolute; right: -26px; top: 0; text-decoration: none !important; color: #cbd5e1 !important; opacity: 0; font-weight: 400; transition: opacity .2s; }
.legal-content h2:hover .legal-anchor, .legal-anchor:focus { opacity: 1; }
@media (max-width: 991px) { .legal-anchor { display: none; } }

/* خلاصه‌ی ساده */
.legal-summary { background: linear-gradient(135deg, #f5f3ff, #eef2ff); border: 1px solid #ddd6fe; border-radius: 18px; padding: 20px 24px; margin-bottom: 8px; }
.legal-summary-title { margin: 0 0 10px !important; font-size: 1.1rem; font-weight: 900; color: #4c1d95 !important; }
.legal-summary ul { margin: 0; }
.legal-summary p:last-child { margin-bottom: 0; }
.legal-summary small { color: #6b7280; }

/* کادرها و جدول‌ها */
.legal-note { background: #fffbeb; border-right: 4px solid #f59e0b; border-radius: 14px; padding: 14px 18px; margin: 18px 0; color: #78350f; font-size: .95rem; line-height: 1.9; }
.legal-note p { margin: 0; }
.legal-content dl { margin: 0 0 16px; }
.legal-content dt { font-weight: 900; color: var(--text-heading); margin-top: 12px; }
.legal-content dd { margin: 2px 0 0; padding-inline-start: 1.2em; }
.legal-content .table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid #e2e8f0; border-radius: 14px; }
.legal-content table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.8; }
.legal-content th, .legal-content td { padding: 10px 14px; text-align: right; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.legal-content th { background: #f8fafc; color: var(--text-heading); font-weight: 900; white-space: nowrap; }
.legal-content tr:last-child td { border-bottom: 0; }

.legal-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; font-size: .92rem; color: #64748b; }
.legal-foot p { margin: 0 0 8px; }

.legal-top { position: fixed; bottom: 90px; left: 20px; z-index: 50; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand-purple); color: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: 0 6px 18px rgba(79, 70, 229, .35); }
.legal-top[hidden] { display: none; }
.legal-toc a:focus-visible, .legal-print:focus-visible, .legal-top:focus-visible, .legal-tabs a:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 2px; }

/* چاپ / PDF */
@media print {
    .site-header-wrapper, footer, .legal-toc, .legal-tabs, .legal-top, .legal-anchor, .hero-crumbs { display: none !important; }
    .legal-hero { background: none !important; color: #000; padding: 0 0 12px; border-bottom: 2px solid #000; }
    .legal-hero p, .legal-meta span { color: #333; background: none; }
    .legal-layout { display: block; }
    .legal-content { border: 0; padding: 0; font-size: 11pt; color: #000; }
    .legal-content h2 { break-after: avoid; color: #000; }
    .legal-summary, .legal-note { break-inside: avoid; background: none; border: 1px solid #999; }
    a { color: #000 !important; text-decoration: none; }
}
