/* ==========================================================================
   Páginas legales (Términos, Privacidad, Cookies, Aviso Legal)
   Layout de dos columnas: índice pegajoso + tarjeta de contenido.
   ========================================================================== */

.legal-page {
    position: relative;
    padding: 140px 0 100px;
    min-height: 100vh;
    overflow: hidden;
}

/* Resplandor decorativo de fondo */
.legal-page::before {
    content: "";
    position: absolute;
    top: -180px;
    left: 50%;
    width: 900px;
    max-width: 120vw;
    height: 520px;
    transform: translateX(-50%);
    background: radial-gradient(50% 50% at 50% 50%, rgba(102, 126, 234, 0.18) 0%, rgba(102, 126, 234, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.legal-page .container {
    position: relative;
    z-index: 1;
}

/* -------------------------------------------------------------- Encabezado */
.legal-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 3.5rem;
}

.legal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.legal-eyebrow svg {
    width: 15px;
    height: 15px;
    color: var(--primary-color);
}

.legal-title {
    font-size: clamp(2.4rem, 6vw, 3.75rem);
    line-height: 1.08;
    font-weight: 800;
    margin: 0 0 1.1rem;
    letter-spacing: -0.02em;
}

.legal-subtitle {
    color: var(--text-muted);
    font-size: 1.075rem;
    line-height: 1.7;
    margin: 0 auto 1.75rem;
    max-width: 620px;
}

.legal-updated {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: rgba(79, 172, 254, 0.1);
    border: 1px solid rgba(79, 172, 254, 0.25);
    color: #7dd3fc;
    font-size: 0.875rem;
    font-weight: 500;
}

.legal-updated svg {
    width: 15px;
    height: 15px;
}

/* -------------------------------------------------------------- Estructura */
.legal-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
    max-width: 1080px;
    margin: 0 auto;
}

/* ------------------------------------------------------------------ Índice */
.legal-toc {
    position: sticky;
    top: 110px;
    align-self: start;
}

.legal-toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 1rem;
    padding-left: 0.9rem;
}

.legal-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid rgba(148, 163, 184, 0.15);
}

.legal-toc li {
    margin: 0;
}

.legal-toc a {
    display: block;
    padding: 0.5rem 0 0.5rem 0.9rem;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-toc a:hover {
    color: var(--text-light);
}

.legal-toc a.is-active {
    color: var(--white);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* ------------------------------------------------------------- Contenido */
.legal-card {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 20px;
    padding: 3rem 3.25rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}

.legal-body {
    counter-reset: legal-section;
    line-height: 1.8;
}

/* Encabezados de sección numerados automáticamente */
.legal-body h2 {
    counter-increment: legal-section;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 2.75rem 0 1.15rem;
    scroll-margin-top: 110px;
}

.legal-body h2::before {
    content: counter(legal-section);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.legal-body h2:first-child {
    margin-top: 0;
}

.legal-body h3 {
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.75rem;
}

.legal-body p {
    color: var(--text-light);
    margin: 0 0 1.25rem;
}

.legal-body a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(102, 126, 234, 0.4);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-body a:hover {
    color: #7dd3fc;
    border-bottom-color: #7dd3fc;
}

/* Listas con marcadores personalizados */
.legal-body ul,
.legal-body ol {
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.legal-body ul li {
    position: relative;
    color: var(--text-light);
    padding-left: 1.75rem;
    margin-bottom: 0.7rem;
}

.legal-body ul li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gradient-accent);
}

.legal-body ol {
    counter-reset: legal-list;
}

.legal-body ol li {
    counter-increment: legal-list;
    position: relative;
    color: var(--text-light);
    padding-left: 1.9rem;
    margin-bottom: 0.7rem;
}

.legal-body ol li::before {
    content: counter(legal-list);
    position: absolute;
    left: 0;
    top: 0.15em;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
}

/* Bloque destacado para datos identificativos / contacto */
.legal-callout {
    display: flex;
    gap: 1rem;
    margin: 2rem 0 0;
    padding: 1.5rem 1.75rem;
    border-radius: 14px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.legal-callout svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    color: var(--primary-color);
}

.legal-callout h3 {
    margin: 0 0 0.4rem;
    color: var(--white);
    font-size: 1.05rem;
}

.legal-callout p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.legal-callout a {
    white-space: nowrap;
}

/* Tabla de datos (aviso legal) */
.legal-datatable {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.legal-datatable th,
.legal-datatable td {
    padding: 0.85rem 1.1rem;
    text-align: left;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.legal-datatable tr:last-child th,
.legal-datatable tr:last-child td {
    border-bottom: none;
}

.legal-datatable th {
    width: 40%;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
    vertical-align: top;
}

.legal-datatable td {
    color: var(--text-light);
}

/* --------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
    .legal-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .legal-toc {
        position: static;
        top: auto;
    }

    .legal-toc ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        border-left: none;
    }

    .legal-toc a {
        padding: 0.4rem 0.85rem;
        margin-left: 0;
        border: 1px solid rgba(148, 163, 184, 0.18);
        border-radius: 999px;
        font-size: 0.82rem;
    }

    .legal-toc a.is-active {
        border-color: var(--primary-color);
        background: rgba(102, 126, 234, 0.12);
    }
}

@media (max-width: 640px) {
    .legal-page {
        padding: 110px 0 70px;
    }

    .legal-card {
        padding: 1.75rem 1.4rem;
        border-radius: 16px;
    }

    .legal-body h2 {
        font-size: 1.2rem;
    }

    .legal-callout {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem;
    }

    .legal-datatable th,
    .legal-datatable td {
        display: block;
        width: 100%;
    }

    .legal-datatable th {
        padding-bottom: 0.15rem;
        border-bottom: none;
    }

    .legal-datatable td {
        padding-top: 0.15rem;
    }
}
