/* ============ LEGAL PAGE — PUBLIC ============ */
.legal-page {
    background: #f8fafc;
    min-height: 100vh;
}

.legal-page[dir="rtl"] {
    text-align: right;
}

/* ===== HERO ===== */
.legal-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 80px 24px 60px;
    position: relative;
    overflow: hidden;
}

.legal-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.25) 0%, transparent 60%);
    pointer-events: none;
}

.legal-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    text-align: center;
}

.legal-hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5b4fc;
}

.legal-hero-icon svg {
    width: 32px;
    height: 32px;
}

.legal-hero-title {
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.legal-hero-subtitle {
    font-size: 17px;
    opacity: 0.7;
    margin: 0 0 28px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.legal-hero-meta {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.legal-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

/* ===== CONTAINER ===== */
.legal-container {
    max-width: 1200px;
    margin: -30px auto 0;
    padding: 0 24px 80px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    position: relative;
    z-index: 2;
}

/* ===== TOC ===== */
.legal-toc {
    position: relative;
}

.legal-toc-inner {
    position: sticky;
    top: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.legal-toc-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 0 0 12px;
}

.legal-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-toc-list li {
    margin: 0;
}

.legal-toc-list a {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.legal-page[dir="rtl"] .legal-toc-list a {
    border-left: none;
    border-right: 2px solid transparent;
}

.legal-toc-list a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.legal-toc-list a.active {
    background: #eef2ff;
    color: #4f46e5;
    border-left-color: #4f46e5;
    font-weight: 600;
}

.legal-page[dir="rtl"] .legal-toc-list a.active {
    border-right-color: #4f46e5;
}

.legal-toc-num {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    flex-shrink: 0;
    padding-top: 1px;
}

.legal-toc-list a.active .legal-toc-num {
    color: #4f46e5;
}

/* ===== CONTENT ===== */
.legal-content {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 48px;
}

.legal-section {
    display: flex;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid #f1f5f9;
    scroll-margin-top: 24px;
}

.legal-section:first-child {
    padding-top: 0;
}

.legal-section:last-of-type {
    border-bottom: none;
}

.legal-section-num {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.legal-section-body {
    flex: 1;
    min-width: 0;
}

.legal-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px;
    letter-spacing: -0.01em;
}

.legal-section-text {
    color: #475569;
    line-height: 1.75;
    font-size: 15px;
    margin: 0;
}

.legal-footer-note {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.legal-cross-link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.legal-cross-link:hover {
    text-decoration: underline;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
    .legal-container {
        grid-template-columns: 1fr;
    }
    .legal-toc-inner {
        position: static;
        max-height: none;
    }
    .legal-content {
        padding: 28px 20px;
    }
    .legal-hero-title {
        font-size: 30px;
    }
    .legal-section {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============ DARK MODE ============ */
html[data-theme="dark"] .legal-page {
    background: #0a0f1c;
}

html[data-theme="dark"] .legal-hero {
    background: linear-gradient(135deg, #060912 0%, #111827 100%);
}

html[data-theme="dark"] .legal-hero-icon {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
    color: #c7d2fe;
}

html[data-theme="dark"] .legal-meta-pill {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
}

html[data-theme="dark"] .legal-toc-inner {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .legal-toc-title {
    color: #94a3b8;
}

html[data-theme="dark"] .legal-toc-list a {
    color: #94a3b8;
}

html[data-theme="dark"] .legal-toc-list a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
}

html[data-theme="dark"] .legal-toc-list a.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border-left-color: #a5b4fc;
}

html[data-theme="dark"] .legal-page[dir="rtl"] .legal-toc-list a.active {
    border-right-color: #a5b4fc;
}

html[data-theme="dark"] .legal-toc-num {
    color: #64748b;
}

html[data-theme="dark"] .legal-toc-list a.active .legal-toc-num {
    color: #a5b4fc;
}

html[data-theme="dark"] .legal-content {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .legal-section {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .legal-section-num {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

html[data-theme="dark"] .legal-section-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .legal-section-text {
    color: #94a3b8;
}

html[data-theme="dark"] .legal-footer-note {
    border-top-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .legal-cross-link {
    color: #a5b4fc;
}