/* ===== LEGAL PAGE SPECIFIC STYLES ===== */

/* ── CSS-driven bilingual block toggling ──────────────────────────────────
   The html[data-lang] attribute is set synchronously by main.js before
   any render, so there is zero flash of wrong-language content.          */
[data-lang-block] { display: none; }

/* Show the matching language block */
html[data-lang="en"] [data-lang-block="en"],
html[data-lang="it"] [data-lang-block="it"] { display: block; }

/* Fallback: if no data-lang yet on html (JS disabled / slow), show EN */
html:not([data-lang]) [data-lang-block="en"] { display: block; }


.legal-page {
    padding-top: 5rem;
}

.legal-hero {
    padding: 5rem 8% 4rem;
    background: linear-gradient(to bottom, var(--bg-lighter), var(--bg-dark));
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 2;
}

.legal-hero .app-badge {
    margin-bottom: 1.2rem;
}

.legal-hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.75rem;
}

.legal-hero .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.legal-body {
    padding: 4rem 8%;
    position: relative;
    z-index: 2;
    max-width: 1600px;
    margin: 0 auto;
}

/* Table of Contents */
.toc {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    margin-bottom: 3.5rem;
    backdrop-filter: blur(10px);
}

.toc h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 1rem;
}

.toc ol {
    list-style: decimal;
    padding-left: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toc ol li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.toc ol li a:hover {
    color: var(--primary);
}

/* Legal Sections */
.legal-section {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--glass-border);
}

.legal-section:last-child {
    border-bottom: none;
}

.legal-section h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legal-section h2 .section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.legal-section p {
    color: var(--text-muted);
    line-height: 1.85;
    margin-bottom: 1rem;
    font-size: 0.98rem;
}

.legal-section ul,
.legal-section ol {
    padding-left: 1.5rem;
    color: var(--text-muted);
    line-height: 1.85;
    margin-bottom: 1rem;
    font-size: 0.98rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.legal-section h3 {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    margin: 1.5rem 0 0.6rem;
}

.legal-section a {
    color: var(--primary);
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.92rem;
}

.data-table th {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--glass-border);
}

.data-table td {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    vertical-align: top;
}

.data-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.02);
}

/* Warning Box */
.warning-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1.2rem 0;
    color: rgba(252, 165, 165, 0.9);
    font-size: 0.95rem;
    line-height: 1.7;
}

.warning-box strong {
    color: #fca5a5;
}

/* Info Box */
.info-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1.2rem 0;
    color: rgba(147, 197, 253, 0.9);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: gap 0.2s;
}

.back-link:hover {
    gap: 0.75rem;
}

/* Legal Nav Tabs -- links between privacy/terms */
.legal-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.legal-tab {
    padding: 0.6rem 1.4rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.legal-tab:hover,
.legal-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .legal-hero h1 {
        font-size: 2rem;
    }
    .legal-body {
        padding: 3rem 5%;
    }
    .data-table {
        display: block;
        overflow-x: auto;
    }
}
