/**
 * UrbanScope - Legal Documentation Styles (Terms of Service & Privacy Policy)
 * Clean, legible, professional layout aligned with brand design tokens.
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --green: #2d5c39;
    --dark-green: #14351e;
    --light-green: #eef6f0;
    --accent-green: #347c47;
    --gold: #c9a24a;
    --text-dark: #1b2e21;
    --text-muted: #5e7163;
    --border-color: #dbe5de;
    --bg-page: #f8faf8;
    --card-bg: #ffffff;
}

body {
    background-color: var(--bg-page);
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', Arial, sans-serif;
    line-height: 1.7;
    margin: 0;
    padding: 0;
}

/* HERO SECTION */
.legal-hero {
    background: linear-gradient(135deg, #14351e 0%, #1e5c33 60%, #2d5c39 100%);
    color: #ffffff;
    padding: 56px 6% 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.legal-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(201, 162, 74, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* TOP BACK NAVIGATION */
.legal-top-nav {
    display: flex;
    justify-content: flex-start;
    max-width: 1200px;
    margin: 0 auto 22px auto;
    position: relative;
    z-index: 2;
}

.legal-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

@media (hover: hover) and (pointer: fine) {
    .legal-back-btn:hover {
        background: rgba(255, 255, 255, 0.26);
        border-color: rgba(255, 255, 255, 0.5);
        color: #ffffff;
        transform: translateX(-3px);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    }
}

.legal-back-btn svg {
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .legal-back-btn:hover svg {
        transform: translateX(-3px);
    }
}

.legal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #f1f8f3;
    margin-bottom: 14px;
}

.legal-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 10px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.legal-hero p {
    font-size: 1.05rem;
    color: #d2e4d7;
    max-width: 680px;
    margin: 0 auto 16px;
}

.legal-meta {
    font-size: 0.85rem;
    color: #a8cfb4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    max-width: 100%;
}

/* DOCUMENT SWITCHER TABS */
.doc-switcher-wrap {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.doc-switcher {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.22);
    padding: 5px;
    border-radius: 999px;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.doc-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    color: #e2ede5;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .doc-tab:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }
}

.doc-tab.active {
    background: #ffffff;
    color: var(--dark-green);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* MAIN LAYOUT */
.legal-main-container {
    max-width: 1200px;
    margin: 40px auto 80px;
    padding: 0 5%;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* SIDEBAR TABLE OF CONTENTS */
.legal-sidebar {
    position: sticky;
    top: 96px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.03);
}

.sidebar-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--dark-green);
    margin: 0 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toc-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .toc-list a:hover {
        color: var(--green);
        background: var(--light-green);
        padding-left: 15px;
    }
}

/* CONTENT CARD */
.legal-content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 42px 48px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.legal-section {
    margin-bottom: 42px;
    scroll-margin-top: 110px;
}

.legal-section:last-child {
    margin-bottom: 0;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid #edf2ee;
}

.section-number {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--light-green);
    color: var(--green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.section-head h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark-green);
    margin: 0;
    letter-spacing: -0.2px;
}

.legal-section p {
    font-size: 0.96rem;
    color: #2c3e31;
    margin: 0 0 16px;
}

.legal-section ul {
    margin: 0 0 18px 24px;
    padding: 0;
    color: #2c3e31;
    font-size: 0.95rem;
}

.legal-section li {
    margin-bottom: 8px;
}

/* CALLOUT BOXES */
.legal-callout {
    background: #f3f8f4;
    border-left: 4px solid var(--green);
    border-radius: 0 12px 12px 0;
    padding: 16px 20px;
    margin: 20px 0;
}

.legal-callout.warning {
    background: #fffbeb;
    border-left-color: #d97706;
}

.legal-callout h4 {
    margin: 0 0 6px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--dark-green);
}

.legal-callout.warning h4 {
    color: #92400e;
}

.legal-callout p {
    margin: 0;
    font-size: 13.5px;
    color: #374151;
}

/* DATA TABLE */
.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 13.5px;
}

.legal-table th,
.legal-table td {
    padding: 12px 14px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.legal-table th {
    background: #eef6f0;
    color: var(--dark-green);
    font-weight: 700;
}

.legal-table tr:nth-child(even) td {
    background: #fafdfa;
}

/* CONTACT CALLOUT CARD */
.legal-contact-box {
    background: linear-gradient(135deg, #f0f7f2 0%, #e6f2e9 100%);
    border: 1px solid #cbe0d1;
    border-radius: 16px;
    padding: 26px 28px;
    margin-top: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.legal-contact-info h3 {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--dark-green);
    margin: 0 0 6px;
}

.legal-contact-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.legal-contact-actions {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-contact-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--green);
    color: #ffffff;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .btn-contact-primary:hover {
        background: var(--dark-green);
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(45, 92, 57, 0.25);
    }
}

.btn-contact-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: #ffffff;
    border: 1px solid #c8dcd0;
    color: var(--green);
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .btn-contact-secondary:hover {
        background: #f0f7f2;
        border-color: var(--green);
    }
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .legal-main-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .legal-sidebar {
        position: static;
        order: -1;
        min-width: 0;
        max-width: 100%;
    }

    .legal-content-card {
        padding: 30px 24px;
        min-width: 0;
        max-width: 100%;
    }

    .legal-hero h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .legal-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .legal-table th,
    .legal-table td {
        min-width: 135px;
    }
}

@media (max-width: 600px) {
    .legal-hero {
        padding: 38px 4% 32px;
    }

    .legal-hero h1 {
        font-size: 1.65rem;
    }

    .doc-switcher {
        width: 100%;
        border-radius: 12px;
        flex-direction: column;
    }

    .doc-tab {
        justify-content: center;
        border-radius: 8px;
    }

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

    .legal-contact-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .legal-contact-actions {
        width: 100%;
    }

    .btn-contact-primary,
    .btn-contact-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Dark Mode Overrides for Legal Pages (Terms & Privacy)
   ========================================================================== */
html.dark-mode {
    --bg-page: #0e1611;
    --card-bg: #16231b;
    --border-color: #26392c;
    --text-dark: #e7f0e9;
    --text-muted: #9eb3a3;
}

html.dark-mode .legal-hero {
    background: linear-gradient(135deg, #112618 0%, #173521 60%, #1f472d 100%);
    border-bottom: 1px solid #26392c;
}

html.dark-mode .doc-tab.active {
    background: #2f7a44;
    color: #ffffff;
    border: 1px solid rgba(134, 239, 172, 0.45);
}

html.dark-mode .legal-section p,
html.dark-mode .legal-section ul {
    color: #c9dbce;
}

html.dark-mode .section-head {
    border-bottom-color: #243629;
}

html.dark-mode .section-number {
    background: #1f3326;
    color: #86efac;
}

html.dark-mode .legal-callout {
    background: #121d16;
    border-left-color: #4ade80;
}

html.dark-mode .legal-callout.warning {
    background: rgba(217, 119, 6, 0.14);
    border-left-color: #f59e0b;
}

/* ============================================================
   LEGAL HUB 20 UI/UX DESIGN SYSTEM POLISHES
   ============================================================ */
.legal-hero h1,
.legal-section h2,
.legal-section h3 {
    text-wrap: balance;
}

.legal-section p,
.legal-hero p {
    text-wrap: pretty;
}

.legal-date,
.section-number,
.legal-law-cite {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

/* Concentric Radius Math (Rule 14) */
.legal-doc-switcher {
    border-radius: 9999px;
    padding: 4px;
}
.doc-tab {
    border-radius: 9999px;
}
.legal-callout {
    border-radius: 12px;
}

