/* Clean, Light Theme CSS for Client Cascade Legal Center */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-dark: #ffffff;
    --bg-darker: #f9fafb; /* Matches main website body background */
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --primary: #10b981; /* Client Cascade Emerald Green */
    --primary-light: #10b981;
    --primary-dark: #059669;
    --accent: #f97316;
    --text-primary: #374151; /* Matches main website text colors */
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Poppins', sans-serif;
}

body.legal-page {
    background-color: var(--bg-darker);
    font-family: var(--font-body);
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Background grid and glows removed - clean body background instead */
.bg-glow-container {
    display: none;
}

/* Header Navbar - Spans 100% width and is solid white to blend the logo */
.legal-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
}
.legal-navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.legal-logo a {
    display: inline-block;
}
.legal-logo img {
    height: 35px;
    display: block;
    vertical-align: middle;
}
.legal-nav-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
}
.btn-back:hover {
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}
.btn-login {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #ffffff !important;
    background: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1.25rem;
    border-radius: 5px;
    transition: all 0.2s ease;
    border: 1px solid var(--primary);
}
.btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Container */
.legal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* Legal center controls (Tabs and Search) */
.legal-controls-wrapper {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.legal-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: center;
}
.legal-tabs {
    display: inline-flex;
    background: #f3f4f6; /* Light grey backdrop */
    padding: 0.25rem;
    border-radius: 6px;
}
.legal-tab-btn {
    border: none;
    background: none;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}
.legal-tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.legal-tab-btn:hover:not(.active) {
    color: var(--text-primary);
}
.legal-search-box {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
    min-width: 250px;
}
.legal-search-input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    color: var(--text-primary);
}
.legal-search-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}
.legal-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* Two-column layout */
.legal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Table of Contents */
.legal-toc-wrapper {
    position: sticky;
    top: 5.5rem; /* Adjusted for sticky header navbar */
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.legal-toc-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}
.legal-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.legal-toc-item a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
}
.legal-toc-item a:hover {
    color: var(--text-primary);
    padding-left: 0.75rem;
}
.legal-toc-item.active a {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: rgba(16, 185, 129, 0.04);
}

/* Document content */
.legal-document-wrapper {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.legal-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}
.btn-print {
    background: none;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}
.btn-print:hover {
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
    background-color: #f9fafb;
}
.legal-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 1.25rem;
}
.legal-intro {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.legal-section {
    margin-bottom: 2rem;
    scroll-margin-top: 6.5rem; /* Adjusted for sticky header */
    transition: opacity 0.2s ease;
}
.legal-section.fade-out {
    opacity: 0.15;
}
.legal-section h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #f3f4f6;
}
.legal-section p {
    margin-bottom: 0.85rem;
    color: var(--text-secondary);
}
.legal-section p strong {
    color: var(--text-primary);
}
.legal-section ul {
    margin-top: 0.4rem;
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}
.legal-section li {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

/* Highlight matching text in search */
.search-highlight {
    background-color: rgba(16, 185, 129, 0.15);
    border-bottom: 2px solid var(--primary);
    border-radius: 2px;
    padding: 0 2px;
}

/* Footer links styles on /earlybird */
.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.2s ease;
    font-weight: 500;
}
.footer-link:hover {
    color: var(--primary) !important;
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 991px) {
    .legal-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .legal-toc-wrapper {
        position: static;
        padding: 1rem;
    }
    .legal-toc-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.4rem;
    }
    .legal-toc-item a {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.25rem 0.4rem;
    }
    .legal-toc-item.active a {
        border-bottom-color: var(--primary);
        border-left: none;
        background: rgba(16, 185, 129, 0.04);
    }
    .legal-document-wrapper {
        padding: 1.75rem;
    }
}

@media (max-width: 600px) {
    .legal-navbar-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .legal-nav-actions {
        width: 100%;
        justify-content: center;
    }
    .legal-controls-wrapper {
        padding: 0.85rem;
    }
    .legal-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .legal-tabs {
        width: 100%;
    }
    .legal-tab-btn {
        flex-grow: 1;
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
    .legal-search-box {
        max-width: 100%;
        min-width: unset;
        width: 100%;
    }
    .legal-toc-list {
        grid-template-columns: 1fr;
    }
    .legal-document-wrapper {
        padding: 1.25rem;
    }
    .legal-title {
        font-size: 1.5rem;
    }
}

/* Legal Page Footer */
.legal-footer {
    background-color: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2rem 0;
    margin-top: 5rem;
    text-align: center;
    width: 100%;
}
.legal-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.legal-footer-copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}
.legal-footer-links {
    margin: 0;
    display: flex;
    gap: 1rem;
}
.legal-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}
.legal-footer-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Print Styling */
@media print {
    body.legal-page {
        background: #ffffff;
        color: #000000;
        font-size: 11pt;
    }
    .bg-glow-container,
    .legal-navbar,
    .legal-controls-wrapper,
    .legal-toc-wrapper,
    .btn-print,
    .legal-nav-actions,
    .legal-footer,
    .legal-meta .btn-print {
        display: none !important;
    }
    .legal-layout {
        display: block;
    }
    .legal-document-wrapper {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .legal-section {
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
    }
    a {
        text-decoration: underline;
        color: #000000;
    }
}
