/* =============================================================================
 * cookies-banner.css — Aviso y centro de preferencias (iOS Safari Fix)
 * ========================================================================== */

:where(#tc-cookies, #tc-cookies *) { box-sizing: border-box; margin: 0; padding: 0; }

#tc-cookies {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: normal;
}

/* Fondo oscurecido adaptado a la Safe Area de iOS */
.tc-ck-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh; /* Soporte dinámico para la barra de Safari en iPhone */
    background: rgba(10, 20, 30, 0.65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 2147483000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 16px calc(20px + env(safe-area-inset-bottom, 0px)) 16px;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    /* Aceleración por hardware para evitar parpadeos en WebKit/Safari */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.tc-ck-overlay.tc-ck-abierto {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.tc-ck-tarjeta {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: 20px;
    padding: 28px 26px 22px 26px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.30);
    text-align: center;
    max-height: calc(85dvh - env(safe-area-inset-bottom, 0px)); /* Altura segura en iOS */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Habilita el scroll fluido nativo de iOS */
    transform: scale(0.96) translateY(14px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tc-ck-overlay.tc-ck-abierto .tc-ck-tarjeta { 
    transform: scale(1) translateY(0); 
}

.tc-ck-logo { 
    display: block; 
    margin: 0 auto 14px auto; 
    width: 170px; 
    max-width: 60%; 
    height: auto; 
}

.tc-ck-titulo { 
    font-size: 1.25rem; 
    font-weight: 800; 
    color: #10263B; 
    margin-bottom: 10px; 
    letter-spacing: -0.3px; 
}

.tc-ck-texto { 
    font-size: 0.9rem; 
    color: #5A6B7B; 
    line-height: 1.55; 
    margin-bottom: 18px; 
}

.tc-ck-boton {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent; /* Elimina recuadro gris al tocar en iPhone */
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tc-ck-boton:active { 
    transform: scale(0.98); /* Mejor respuesta táctil en móvil */
}

.tc-ck-aceptar {
    background: linear-gradient(90deg, #17C8F3, #0A84FF);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(10, 132, 255, 0.30);
}

.tc-ck-rechazar {
    background: #EEF1F5;
    color: #10263B;
}

.tc-ck-rechazar:hover { background: #E2E7EE; }

.tc-ck-configurar {
    background: #ffffff;
    color: #0A84FF;
    border: 1.5px solid #0A84FF;
}

.tc-ck-configurar:hover { background: rgba(10, 132, 255, 0.06); }

.tc-ck-enlaces { 
    margin-top: 12px; 
    padding-top: 12px; 
    border-top: 1px solid #EDF0F4; 
    font-size: 0.8rem; 
}

.tc-ck-enlaces a { 
    color: #0A84FF; 
    text-decoration: none; 
    font-weight: 600; 
    margin: 0 8px; 
}

.tc-ck-enlaces a:hover { text-decoration: underline; }

/* ------------------------------- PREFERENCIAS ------------------------------ */
.tc-ck-categoria {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid #EDF0F4;
    border-radius: 14px;
    margin-bottom: 10px;
    background: #FAFBFC;
}

.tc-ck-categoria h4 { font-size: 0.88rem; color: #10263B; font-weight: 700; margin-bottom: 3px; }
.tc-ck-categoria p  { font-size: 0.78rem; color: #5A6B7B; line-height: 1.45; }

.tc-ck-siempre {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    color: #0A84FF;
    background: rgba(10, 132, 255, 0.10);
    border-radius: 20px;
    padding: 4px 10px;
    white-space: nowrap;
    align-self: center;
}

/* Interruptor táctil para iOS */
.tc-ck-interruptor { 
    position: relative; 
    flex-shrink: 0; 
    width: 44px; 
    height: 24px; 
    align-self: center; 
}

.tc-ck-interruptor input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.tc-ck-interruptor span {
    position: absolute;
    inset: 0;
    background: #D3DAE3;
    border-radius: 24px;
    transition: background 0.2s ease;
    pointer-events: none;
}

.tc-ck-interruptor span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
}

.tc-ck-interruptor input:checked + span { background: #0A84FF; }
.tc-ck-interruptor input:checked + span::after { transform: translateX(20px); }

/* ------------------------------ CONFIRMACIÓN ------------------------------- */
.tc-ck-check {
    width: 64px;
    height: 64px;
    margin: 6px auto 14px auto;
    border-radius: 50%;
    background: rgba(52, 199, 89, 0.12);
    color: #34C759;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botón flotante reabrir adaptado a la barra inferior de iPhone */
.tc-ck-reabrir {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: calc(18px + env(safe-area-inset-left, 0px));
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    z-index: 2147482900;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}

.tc-ck-reabrir:active { transform: scale(0.92); }

@media (max-width: 480px) {
    .tc-ck-tarjeta { 
        padding: 22px 18px 16px 18px; 
        border-radius: 18px; 
    }
    .tc-ck-titulo { font-size: 1.1rem; }
}