/* Legal pages (Views/Legal/_LegalLayout.cshtml): Terms, Privacy, Refund and Cookie policies.
   Uses logical properties so the same rules work for the Arabic (RTL) and English (LTR) pages. */
.legal-page {
    --legal-red: #C91D13;
    --legal-red-deep: #8F0D06;
    --legal-red-tint: #FFF4F3;
    --legal-red-line: #F6D2CF;
    --legal-navy: #0E243A;
    --legal-text: #3F4D5A;
    --legal-muted: #6B7785;
    --legal-line: #E9ECEF;
    --legal-gradient: linear-gradient(135deg, #DE2A1E 0%, #C91D13 50%, #A0120A 100%);
    color: var(--legal-navy);
    padding-bottom: 80px;
}

.legal-container {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 20px;
}

/* ---------- Hero ---------- */

.legal-hero {
    position: relative;
    margin: 24px 16px 0;
    padding: 56px 0 0;
    overflow: hidden;
    border-radius: 32px;
    background: var(--legal-gradient);
    color: #fff;
    text-align: center;
}

.legal-hero::before,
.legal-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.legal-hero::before {
    inset-inline-start: -120px;
    top: -160px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
}

.legal-hero::after {
    inset-inline-end: -100px;
    bottom: -200px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(255, 190, 180, 0.25) 0%, rgba(255, 190, 180, 0) 70%);
}

.legal-hero .legal-container {
    position: relative;
    z-index: 1;
}

.legal-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.legal-title {
    margin: 18px 0 8px;
    font-size: 40px;
    font-weight: 800;
    line-height: 1.4;
    color: #fff;
}

.legal-updated {
    margin: 0;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
}

/* Document switcher: white pills sitting on the bottom edge of the hero */
.legal-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding: 8px;
    border-radius: 22px 22px 0 0;
    background: rgba(255, 255, 255, 0.14);
}

.legal-tab {
    padding: 11px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    color: #fff !important;
    white-space: nowrap;
}

.legal-tab:hover {
    background: rgba(255, 255, 255, 0.16);
}

.legal-tab.is-active {
    background: #fff;
    color: var(--legal-red) !important;
    box-shadow: 0 8px 20px rgba(90, 6, 2, 0.25);
}

/* ---------- Body ---------- */

.legal-body {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    align-items: start;
    gap: 32px;
    margin-top: 40px;
}

.legal-toc {
    position: sticky;
    top: 24px;
}

.legal-toc-card {
    padding: 20px;
    border: 1px solid var(--legal-line);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(14, 36, 58, 0.05);
}

.legal-toc-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 800;
    color: var(--legal-red);
}

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

.legal-toc-list li {
    counter-increment: legal-toc;
}

.legal-toc-list a {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--legal-text) !important;
}

.legal-toc-list a::before {
    content: counter(legal-toc);
    flex: 0 0 auto;
    min-width: 18px;
    font-weight: 800;
    color: var(--legal-red);
}

.legal-toc-list a:hover {
    background: var(--legal-red-tint);
}

.legal-toc-list a.is-active {
    background: var(--legal-red-tint);
    color: var(--legal-red) !important;
    font-weight: 700;
}

/* ---------- Document ---------- */

.legal-content {
    padding: 36px 40px;
    border: 1px solid var(--legal-line);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(14, 36, 58, 0.06);
    counter-reset: legal-section;
    text-align: start;
}

.legal-draft {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
    padding: 14px 18px;
    border: 1px solid var(--legal-red-line);
    border-radius: 16px;
    background: var(--legal-red-tint);
    font-size: 14px;
    line-height: 1.8;
    color: var(--legal-red-deep);
}

.legal-draft svg {
    flex: 0 0 auto;
    margin-top: 3px;
}

.legal-intro {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 2;
    color: var(--legal-text);
}

.legal-content section {
    counter-increment: legal-section;
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid var(--legal-line);
    scroll-margin-top: 24px;
}

.legal-content section:first-of-type {
    border-top: 0;
    margin-top: 8px;
}

.legal-content h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.6;
    color: var(--legal-navy);
}

.legal-content h2::before {
    content: counter(legal-section);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--legal-gradient);
    font-size: 15px;
    color: #fff;
}

.legal-content p,
.legal-content li {
    font-size: 15px;
    line-height: 2;
    color: var(--legal-text);
}

.legal-content p {
    margin: 0 0 12px;
}

.legal-content ul {
    margin: 0 0 12px;
    padding-inline-start: 22px;
}

.legal-content li::marker {
    color: var(--legal-red);
}

.legal-content strong {
    color: var(--legal-navy);
}

.legal-content a {
    color: var(--legal-red) !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

/* Business/legal decisions still open — shown so nobody mistakes the draft for final text */
.legal-open {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 8px;
    background: #FFF6DB;
    border: 1px dashed #E0B100;
    font-size: 13px;
    font-weight: 700;
    color: #8A6A00;
}

.legal-company {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 24px;
    margin: 0;
    padding: 18px 20px;
    border-radius: 18px;
    background: #F8F9FA;
}

.legal-company div {
    font-size: 14px;
    line-height: 1.8;
    color: var(--legal-text);
}

.legal-company dt {
    font-size: 12px;
    font-weight: 700;
    color: var(--legal-muted);
}

.legal-company dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--legal-navy);
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .legal-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-toc {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .legal-hero {
        margin: 12px 8px 0;
        padding-top: 40px;
        border-radius: 24px;
    }

    .legal-title {
        font-size: 28px;
    }

    .legal-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .legal-container {
        padding-inline: 12px;
    }

    .legal-body {
        margin-top: 24px;
        gap: 20px;
    }

    .legal-content {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .legal-content h2 {
        font-size: 18px;
    }

    .legal-company {
        grid-template-columns: minmax(0, 1fr);
    }
}
