/* ============================================
   Fibofi Legal Pages Stylesheet
   Uses CSS variables from _LegalLayout.cshtml
   Brand: Fibofi Red #E8553A, Light theme
   Fonts: DM Sans (headings), Outfit (body)
   ============================================ */

/* --- Scroll Progress Bar --- */
.legal-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent, #E8553A);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --- Page Container (with TOC sidebar) --- */
.legal-page {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1rem 3rem;
    gap: 2.5rem;
    line-height: 1.7;
}

/* --- Page Container (no TOC) --- */
.legal-page-full {
    max-width: 820px;
    margin: 0 auto;
    padding: 2.5rem 1rem 3rem;
    line-height: 1.7;
}

/* --- Table of Contents (Sticky Sidebar) --- */
.legal-toc {
    position: sticky;
    top: 100px;
    width: 260px;
    min-width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--bg-secondary, #ffffff);
    border-radius: 12px;
    border: 1px solid var(--card-border, rgba(0,0,0,0.06));
    align-self: flex-start;
}

.legal-toc h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #55556a);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border, rgba(0,0,0,0.08));
}

.legal-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-toc li {
    margin-bottom: 0.25rem;
}

.legal-toc a {
    display: block;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #55556a);
    text-decoration: none;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.legal-toc a:hover {
    color: var(--accent, #E8553A);
    background: var(--accent-light, rgba(232,85,58,0.06));
}

.legal-toc a.active {
    color: var(--accent, #E8553A);
    background: var(--accent-light, rgba(232,85,58,0.08));
    border-left-color: var(--accent, #E8553A);
    font-weight: 500;
}

/* --- Content Area --- */
.legal-content {
    flex: 1;
    max-width: 820px;
    min-width: 0;
}

/* --- Headings --- */
.legal-content h1,
.legal-page-full h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a22);
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--accent, #E8553A);
}

.legal-content h2,
.legal-page-full h2 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a22);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-left: 12px;
    border-left: 4px solid var(--accent, #E8553A);
}

.legal-content h3,
.legal-page-full h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a22);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* --- Version Badge --- */
.legal-version {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary, #55556a);
    background: var(--bg-tertiary, #f0f0f4);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 2rem;
}

/* --- Paragraphs --- */
.legal-content p,
.legal-page-full p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-primary, #1a1a22);
}

/* --- Lists with Fibofi Red markers --- */
.legal-content ul,
.legal-page-full ul {
    list-style: none;
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.legal-content ul li,
.legal-page-full ul li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary, #1a1a22);
}

.legal-content ul li::before,
.legal-page-full ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent, #E8553A);
}

.legal-content ol,
.legal-page-full ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-content ol li,
.legal-page-full ol li {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* --- Tables (zebra striping) --- */
.legal-content table,
.legal-page-full table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--card-border, rgba(0,0,0,0.08));
}

.legal-content thead th,
.legal-page-full thead th {
    background: var(--accent, #E8553A);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    padding: 0.75rem 1rem;
}

.legal-content tbody td,
.legal-page-full tbody td {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary, #1a1a22);
    border-bottom: 1px solid var(--card-border, rgba(0,0,0,0.04));
}

.legal-content tbody tr:nth-child(even),
.legal-page-full tbody tr:nth-child(even) {
    background: var(--bg-tertiary, #f0f0f4);
}

.legal-content tbody tr:hover,
.legal-page-full tbody tr:hover {
    background: var(--accent-light, rgba(232,85,58,0.04));
}

/* --- Placeholder highlight --- */
.legal-placeholder {
    background: var(--accent-light, rgba(232,85,58,0.1));
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    color: var(--accent, #E8553A);
    font-size: 0.85rem;
}

/* --- Last Updated --- */
.legal-footer-meta {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border, rgba(0,0,0,0.08));
    font-size: 0.8rem;
    color: var(--text-secondary, #55556a);
}

/* --- Links inside content --- */
.legal-content a,
.legal-page-full a {
    color: var(--accent, #E8553A);
    text-decoration: none;
    transition: opacity 0.2s;
}

.legal-content a:hover,
.legal-page-full a:hover {
    opacity: 0.8;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .legal-page {
        flex-direction: column;
        padding: 1.5rem 1rem;
    }

    .legal-toc {
        position: relative;
        top: 0;
        width: 100%;
        min-width: unset;
        max-height: none;
        margin-bottom: 1.5rem;
    }

    .legal-content h1,
    .legal-page-full h1 {
        font-size: 1.5rem;
    }

    .legal-content h2,
    .legal-page-full h2 {
        font-size: 1.15rem;
    }

    .legal-content table,
    .legal-page-full table {
        display: block;
        overflow-x: auto;
    }
}

/* --- Print Styles --- */
@media print {
    .legal-progress-bar {
        display: none !important;
    }

    .legal-toc {
        display: none !important;
    }

    .legal-page {
        display: block;
        max-width: 100%;
        padding: 0;
    }

    .legal-content,
    .legal-page-full {
        max-width: 100%;
    }

    .legal-content h1,
    .legal-page-full h1 {
        font-size: 1.5rem;
    }

    .legal-content h2,
    .legal-page-full h2 {
        font-size: 1.2rem;
        break-after: avoid;
    }

    .legal-content table,
    .legal-page-full table {
        break-inside: avoid;
    }

    a[href]::after {
        content: none;
    }
}
