/* public/css/legal.css - Términos y Condiciones y Política de Privacidad */

html { scroll-behavior: smooth; }

/* Fondo de las páginas públicas (en el panel se usa el fondo del propio layout) */
body.legal-body {
    margin: 0;
    padding-top: 56px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f6fa;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(90, 100, 150, 0.17) 1px, transparent 1.4px),
        radial-gradient(560px 440px at 6% 4%, rgba(255, 212, 168, 0.45), transparent 70%),
        radial-gradient(820px 600px at 46% 108%, rgba(118, 130, 255, 0.32), transparent 70%),
        radial-gradient(640px 420px at 100% 38%, rgba(160, 190, 255, 0.14), transparent 70%);
    background-size: 22px 22px, auto, auto, auto;
    background-attachment: fixed;
}

.lg,
.lg * {
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.lg {
    --lg-ink: #171717;
    --lg-text: #404040;
    --lg-muted: #737373;
    --lg-line: #ececec;
    --lg-accent: #0a6fd6;

    flex: 1;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    font-size: 13px;
    line-height: 1.7;
    color: var(--lg-text);
}

/* ===== Cabecera ===== */
.lg-hero {
    position: relative;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--lg-line);
    border-radius: 16px;
    box-shadow: 0 6px 22px -14px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.lg-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #0095f6, #0a6fd6);
}

.lg-hero-top { display: flex; align-items: center; gap: 0.85rem; }

.lg-hero-ico {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    color: var(--lg-accent);
    background: #e6f2ff;
    border-radius: 12px;
}

.lg-hero-ico svg { width: 20px; height: 20px; }

.lg-hero small {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--lg-accent);
}

.lg-hero h1 {
    margin: 0.1rem 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--lg-ink);
}

.lg-hero p { margin: 0.6rem 0 0; max-width: 78ch; font-size: 0.8rem; color: var(--lg-muted); }

.lg-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }

.lg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 22px;
    padding: 0 0.6rem;
    font-size: 0.66rem;
    font-weight: 500;
    color: #525252;
    background: #f3f4f6;
    border-radius: 999px;
}

.lg-chip svg { width: 12px; height: 12px; color: var(--lg-muted); }
.lg-chip--ok { color: #15803d; background: #e8f8ee; }
.lg-chip--ok svg { color: #16a34a; }

/* ===== Rejilla: índice + documento ===== */
.lg-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }

.lg-toc {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--lg-line);
    border-radius: 14px;
    scrollbar-width: thin;
}

.lg-toc summary {
    padding: 0.4rem 0.6rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--lg-muted);
    cursor: pointer;
    list-style: none;
}

.lg-toc summary::-webkit-details-marker { display: none; }

.lg-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }

.lg-toc a {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.32rem 0.6rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #525252;
    text-decoration: none;
    border-radius: 8px;
    counter-increment: toc;
    transition: background 0.12s, color 0.12s;
}

.lg-toc a::before {
    content: counter(toc);
    min-width: 1.15em;
    font-size: 0.66rem;
    font-weight: 600;
    color: #a3a3a3;
    text-align: right;
}

.lg-toc a:hover { background: #f3f4f6; color: var(--lg-ink); }
.lg-toc a.activo { background: #e6f2ff; color: #0a5cb0; font-weight: 600; }
.lg-toc a.activo::before { color: var(--lg-accent); }

/* ===== Documento ===== */
.lg-doc {
    padding: 1.5rem 1.75rem 1.75rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--lg-line);
    border-radius: 16px;
    box-shadow: 0 6px 22px -14px rgba(15, 23, 42, 0.2);
}

.lg-sec { padding: 1.1rem 0; border-top: 1px solid #f1f1f1; scroll-margin-top: 76px; }
.lg-sec:first-child { padding-top: 0; border-top: 0; }
.lg-sec:last-child { padding-bottom: 0; }

.lg-sec h2 {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.005em;
    color: var(--lg-ink);
}

.lg-sec h2 .n {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--lg-accent);
    background: #e6f2ff;
    border-radius: 7px;
    flex: none;
    transform: translateY(-1px);
}

.lg-sec h3 { margin: 1rem 0 0.35rem; font-size: 0.8rem; font-weight: 700; color: var(--lg-ink); }
.lg-sec p { margin: 0 0 0.6rem; }
.lg-sec p:last-child { margin-bottom: 0; }
.lg-sec strong { color: var(--lg-ink); font-weight: 600; }
.lg-sec a { color: var(--lg-accent); text-decoration: underline; text-underline-offset: 2px; }

.lg-sec ul,
.lg-sec ol.lista { margin: 0.2rem 0 0.7rem; padding: 0; list-style: none; display: grid; gap: 0.3rem; }

.lg-sec ul li,
.lg-sec ol.lista li { position: relative; padding-left: 1.15rem; }

.lg-sec ul li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.65em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #0095f6;
}

.lg-sec ol.lista { counter-reset: it; }
.lg-sec ol.lista li { counter-increment: it; }
.lg-sec ol.lista li::before {
    content: counter(it) ".";
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--lg-accent);
}

/* Tablas */
.lg-tabla { margin: 0.5rem 0 0.8rem; overflow-x: auto; border: 1px solid var(--lg-line); border-radius: 12px; }
.lg-tabla table { width: 100%; min-width: 560px; border-collapse: collapse; }
.lg-tabla th {
    padding: 0.5rem 0.75rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
    color: var(--lg-muted);
    background: #fafafa;
    border-bottom: 1px solid var(--lg-line);
}
.lg-tabla td { padding: 0.55rem 0.75rem; font-size: 0.74rem; line-height: 1.55; vertical-align: top; border-bottom: 1px solid #f3f3f3; }
.lg-tabla tr:last-child td { border-bottom: 0; }
.lg-tabla td:first-child { width: 26%; font-weight: 600; color: var(--lg-ink); }

/* Notas */
.lg-nota {
    display: flex;
    gap: 0.6rem;
    margin: 0.7rem 0;
    padding: 0.65rem 0.85rem;
    font-size: 0.76rem;
    line-height: 1.6;
    border: 1px solid;
    border-radius: 12px;
}

.lg-nota svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.lg-nota > div { min-width: 0; }
.lg-nota p { margin: 0 0 0.3rem; }
.lg-nota--info { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }
.lg-nota--aviso { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.lg-nota--ok { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.lg-nota strong { color: inherit; }

/* Contacto */
.lg-contacto { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.6rem; margin: 0.6rem 0; }
.lg-contacto > div { padding: 0.6rem 0.8rem; background: #f8fafc; border: 1px solid var(--lg-line); border-radius: 12px; min-width: 0; }
.lg-contacto dt { font-size: 0.58rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lg-muted); }
.lg-contacto dd { margin: 0.1rem 0 0; font-size: 0.78rem; color: var(--lg-ink); word-break: break-word; }

.lg-cierre {
    margin-top: 1.25rem;
    padding-top: 0.9rem;
    font-size: 0.7rem;
    color: var(--lg-muted);
    border-top: 1px dashed #e2e2e2;
}

.lg-cierre a { color: var(--lg-accent); }

/* ===== Tabletas y teléfonos ===== */
@media (max-width: 900px) {
    .lg-grid { grid-template-columns: minmax(0, 1fr); }
    .lg-toc { position: static; max-height: none; }
    .lg-toc summary { cursor: pointer; }
    .lg-toc[open] summary { border-bottom: 1px solid #f1f1f1; margin-bottom: 0.3rem; }
}

@media (max-width: 600px) {
    .lg { padding: 0.75rem 0.5rem 2rem; font-size: 12.5px; }
    .lg-hero { padding: 1rem 1rem 1rem 1.1rem; }
    .lg-hero h1 { font-size: 1.02rem; }
    .lg-hero-ico { width: 36px; height: 36px; }
    .lg-doc { padding: 1rem 0.9rem 1.25rem; border-radius: 14px; }
    .lg-sec h2 { font-size: 0.88rem; }
    .lg-contacto { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Impresión ===== */
@media print {
    body.legal-body { background: #fff; padding-top: 0; }
    .pb, .ft, .lg-toc { display: none !important; }
    .lg { max-width: none; padding: 0; font-size: 11px; }
    .lg-grid { display: block; }
    .lg-hero, .lg-doc { border: 0; box-shadow: none; background: #fff; }
    .lg-sec { break-inside: avoid; }
}

/* ===== Texto justificado ===== */
/* Los párrafos, las listas y las notas se justifican y las palabras NUNCA se cortan con guion: cuando no caben
   pasan enteras a la línea siguiente. Títulos, tablas y datos de contacto van alineados a la izquierda. */
.lg-hero p,
.lg-sec p,
.lg-sec ul li,
.lg-sec ol.lista li,
.lg-nota > div {
    text-align: justify;
    text-justify: inter-word;
    -webkit-hyphens: none;
    hyphens: none;
    overflow-wrap: normal;
    word-break: normal;
}

.lg-nota strong { display: block; text-align: left; }
.lg-tabla td,
.lg-tabla th,
.lg-contacto dd,
.lg-cierre { text-align: left; -webkit-hyphens: none; hyphens: none; }

/* Solo las direcciones y correos larguísimos pueden partirse, para que no rompan el diseño */
.lg-contacto dd { overflow-wrap: anywhere; }
