/**
 * NASplayer - Legal & Compliance Document Stylesheet
 * Strict Apple App Store Guideline 5.1.1 & GDPR/CCPA Presentation
 */

.legal-page {
    padding-top: calc(var(--header-height) + 50px);
    padding-bottom: 120px;
    min-height: 100vh;
}

.legal-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px auto;
}

.legal-title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 18px;
    color: #ffffff;
}

.legal-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.legal-meta-item strong {
    color: #ffffff;
}

.legal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 60px;
    align-items: flex-start;
}

/* Sticky TOC Sidebar */
.toc-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 30px);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    max-height: calc(100vh - var(--header-height) - 60px);
    overflow-y: auto;
}

.toc-title {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toc-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    display: block;
}

.toc-link:hover, .toc-link.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--primary-light);
}

/* Article Body */
.legal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px;
    color: #cbd5e1;
    line-height: 1.8;
}

.legal-section {
    margin-bottom: 50px;
}

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

.legal-section h2 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 24px 0 12px 0;
}

.legal-section p {
    margin-bottom: 16px;
    font-size: 0.98rem;
}

.legal-section ul, .legal-section ol {
    margin: 12px 0 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-section li {
    font-size: 0.96rem;
}

/* Callouts */
.callout {
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 24px 0;
    border-left: 4px solid;
    background: rgba(255, 255, 255, 0.02);
}

.callout.success {
    background: rgba(16, 185, 129, 0.06);
    border-color: var(--accent-emerald);
}

.callout.primary {
    background: rgba(99, 102, 241, 0.06);
    border-color: var(--primary-light);
}

.callout.warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: var(--accent-amber);
}

.callout-title {
    font-weight: 700;
    font-size: 1.02rem;
    color: #ffffff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Legal Tables */
.legal-table-wrapper {
    overflow-x: auto;
    margin: 24px 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.legal-table th {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-weight: 600;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.legal-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.legal-table tr:last-child td {
    border-bottom: none;
}

/* Contact box */
.contact-box {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 24px;
}

.contact-box a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
}

.contact-box a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .legal-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .toc-sidebar {
        display: none;
    }
    .legal-content {
        padding: 28px 20px;
    }
}

/* Light Mode for Legal Pages */
[data-theme="light"] .legal-content {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    color: #334155 !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .legal-title,
[data-theme="light"] .legal-section h2,
[data-theme="light"] .legal-section h3,
[data-theme="light"] .callout-title,
[data-theme="light"] .legal-meta-item strong {
    color: #0f172a !important;
}

[data-theme="light"] .toc-sidebar {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .toc-link {
    color: #475569 !important;
}

[data-theme="light"] .toc-link:hover,
[data-theme="light"] .toc-link.active {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .legal-table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

[data-theme="light"] .legal-table td {
    color: #334155 !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .compliance-callout {
    background: rgba(99, 102, 241, 0.04) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}

[data-theme="light"] .contact-box {
    background: rgba(99, 102, 241, 0.04) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}
