/* ════════════════════════════════════════════════════════
   COOKIES — banner + panel de configuración
   ════════════════════════════════════════════════════════ */
/* El contenedor siempre está en el DOM, pero el banner y panel se controlan individualmente */
.cookies__banner[hidden],
.cookies__panel[hidden] {
    display: none;
}

/* ─── Banner inferior ─────────────────────────── */
.cookies__banner {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 9000;
    background-color: rgb(var(--palette-0));
    color: rgb(var(--clr-text-inverse));
    border-top: 1px solid rgb(var(--clr-text-inverse) / 0.15);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    animation: cookiesEntrada 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cookiesEntrada {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.cookies__banner[hidden] {
    display: none;
}

.cookies__banner-interior {
    max-width: 1310px;
    margin-inline: auto;
    padding: var(--space-m);
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

.cookies__titulo {
    font-family: var(--font-heading);
    font-size: var(--font-size-label);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.25rem;
    text-transform: none;
    color: rgb(var(--clr-text-inverse));
}

.cookies__descripcion {
    font-size: var(--font-size-label);
    line-height: 1.45;
    margin: 0;
    color: rgb(var(--clr-text-inverse) / 0.8);
    max-width: 65ch;
}

.cookies__enlace {
    color: rgb(var(--clr-text-inverse));
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cookies__enlace:hover,
.cookies__enlace:focus-visible {
    color: rgb(var(--clr-accent));
    outline: none;
}

.cookies__acciones {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ─── Botones ─────────────────────────────────── */
.cookies__boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    font-family: var(--font-base);
    font-size: var(--font-size-label);
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--radius-s, 4px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.cookies__boton--principal {
    background-color: rgb(var(--clr-accent));
    color: rgb(var(--clr-text-inverse));
}

.cookies__boton--principal:hover,
.cookies__boton--principal:focus-visible {
    background-color: rgb(var(--clr-accent) / 0.85);
    outline: none;
}

.cookies__boton--secundario {
    background-color: transparent;
    color: rgb(var(--clr-text-inverse));
    border-color: rgb(var(--clr-text-inverse) / 0.3);
}

.cookies__boton--secundario:hover,
.cookies__boton--secundario:focus-visible {
    background-color: rgb(var(--clr-text-inverse) / 0.1);
    border-color: rgb(var(--clr-text-inverse) / 0.6);
    outline: none;
}

/* ─── Tablet+ : banner en una sola fila ───────── */
@media (min-width: 768px) {
    .cookies__banner-interior {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-l);
        padding: var(--space-m) var(--space-l);
    }

    .cookies__acciones {
        flex-shrink: 0;
        flex-wrap: nowrap;
    }

    .cookies__boton {
        flex: 0 0 auto;
    }
}

/* ════════════════════════════════════════════════════════
   PANEL DE CONFIGURACIÓN
   ════════════════════════════════════════════════════════ */
.cookies__panel[hidden] {
    display: none;
}

.cookies__panel {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.cookies__panel-fondo {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cookies__panel-caja {
    position: relative;
    background-color: rgb(var(--clr-bg));
    color: rgb(var(--clr-text));
    border-radius: var(--radius-m, 8px) var(--radius-m, 8px) 0 0;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    animation: cookiesPanelEntrada 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cookiesPanelEntrada {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cookies__panel-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m);
    border-bottom: 1px solid rgb(var(--clr-border) / 0.15);
}

.cookies__panel-titulo {
    font-family: var(--font-heading);
    font-size: var(--font-size-h5);
    font-weight: 700;
    margin: 0;
    text-transform: none;
    line-height: 1.2;
}

.cookies__panel-cerrar {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgb(var(--clr-text));
    border-radius: var(--radius-s, 4px);
    transition: background-color 150ms ease;
    flex-shrink: 0;
}

.cookies__panel-cerrar:hover,
.cookies__panel-cerrar:focus-visible {
    background-color: rgb(var(--clr-border) / 0.1);
    outline: none;
}

.cookies__panel-cerrar svg {
    width: 18px;
    height: 18px;
}

.cookies__panel-cuerpo {
    padding: var(--space-m);
    overflow-y: auto;
    flex: 1;
}

.cookies__panel-intro {
    font-size: var(--font-size-label);
    line-height: 1.5;
    margin: 0 0 var(--space-m);
    color: rgb(var(--clr-text) / 0.8);
}

/* ─── Categoría ───────────────────────────────── */
.cookies__categoria {
    padding: var(--space-m) 0;
    border-top: 1px solid rgb(var(--clr-border) / 0.15);
}

.cookies__categoria:first-of-type {
    border-top: none;
    padding-top: 0;
}

.cookies__categoria-cabecera {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-m);
    flex-wrap: wrap;
}

.cookies__categoria-cabecera > div:first-child {
    flex: 1 1 200px;
    min-width: 0;
}

.cookies__categoria-titulo {
    font-family: var(--font-heading);
    font-size: var(--font-size-h6);
    font-weight: 700;
    margin: 0 0 0.25rem;
    text-transform: none;
    line-height: 1.3;
}

.cookies__categoria-descripcion {
    font-size: var(--font-size-mini);
    line-height: 1.5;
    margin: 0;
    color: rgb(var(--clr-text) / 0.7);
}

/* ─── Interruptor (toggle) ────────────────────── */
.cookies__interruptor {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.cookies__interruptor input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cookies__interruptor-pista {
    width: 44px;
    height: 24px;
    background-color: rgb(var(--clr-border) / 0.3);
    border-radius: 999px;
    position: relative;
    transition: background-color 200ms ease;
}

.cookies__interruptor-pista::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: rgb(var(--clr-bg));
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cookies__interruptor input:checked + .cookies__interruptor-pista {
    background-color: rgb(var(--clr-accent));
}

.cookies__interruptor input:checked + .cookies__interruptor-pista::after {
    transform: translateX(20px);
}

.cookies__interruptor input:focus-visible + .cookies__interruptor-pista {
    outline: 2px solid rgb(var(--clr-accent));
    outline-offset: 2px;
}

.cookies__interruptor--bloqueado {
    cursor: not-allowed;
}

.cookies__interruptor-etiqueta {
    font-family: var(--font-mono);
    font-size: var(--font-size-caption);
    color: rgb(var(--clr-text) / 0.5);
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* ─── Pie del panel ───────────────────────────── */
.cookies__panel-pie {
    padding: var(--space-m);
    border-top: 1px solid rgb(var(--clr-border) / 0.15);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cookies__panel-pie .cookies__boton {
    flex: 1 1 auto;
}

.cookies__panel-pie .cookies__boton--secundario {
    color: rgb(var(--clr-text));
    border-color: rgb(var(--clr-border) / 0.3);
}

.cookies__panel-pie .cookies__boton--secundario:hover,
.cookies__panel-pie .cookies__boton--secundario:focus-visible {
    background-color: rgb(var(--clr-border) / 0.1);
    border-color: rgb(var(--clr-border) / 0.6);
}

/* ─── Tablet+ : panel centrado vertical y horizontal ── */
@media (min-width: 600px) {
    .cookies__panel {
        align-items: center;
        padding: var(--space-m);
    }

    .cookies__panel-caja {
        border-radius: var(--radius-m, 8px);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

    .cookies__panel-cabecera,
    .cookies__panel-cuerpo,
    .cookies__panel-pie {
        padding: var(--space-l);
    }

    .cookies__panel-pie {
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .cookies__panel-pie .cookies__boton {
        flex: 0 0 auto;
    }
}

/* ─── Bloqueo de scroll del body cuando el panel está abierto ─ */
.cookies-panel-abierto {
    overflow: hidden;
}

/* ─── Reduce motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cookies__banner,
    .cookies__panel-caja,
    .cookies__boton,
    .cookies__interruptor-pista,
    .cookies__interruptor-pista::after {
        animation: none;
        transition: none;
    }
}

/* ─── Visually hidden ─────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Botón flotante "Gestionar cookies" ──────── */
.cookies__flotante {
    position: fixed;
    left: var(--space-m);
    bottom: var(--space-m);
    z-index: 8000;

    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background-color: rgb(var(--palette-0));
    color: rgb(var(--clr-text-inverse));
    border: 1px solid rgb(var(--clr-text-inverse) / 0.2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 200ms ease, background-color 200ms ease, opacity 200ms ease;
    opacity: 0.7;
}

.cookies__flotante:hover,
.cookies__flotante:focus-visible {
    opacity: 1;
    transform: scale(1.05);
    background-color: rgb(var(--clr-accent));
    outline: none;
}

.cookies__flotante svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Ocultar el botón flotante mientras el banner está visible */
.cookies__banner:not([hidden]) ~ .cookies__flotante,
.cookies__panel:not([hidden]) ~ .cookies__flotante {
    opacity: 0;
    pointer-events: none;
}