/* ============================================
   FPM Chile — Estilos del Banner de Cookies
   Ley N° 21.719 — Sin dark patterns
   ============================================ */

/* ------------------------------------------
   BANNER DE CONSENTIMIENTO
   ------------------------------------------ */
.cb {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, .12);
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.4, 0, .2, 1);
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cb-visible {
    transform: translateY(0);
}

.cb-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cb-text {
    flex: 1;
    min-width: 280px;
}

.cb-text p {
    font-size: .88rem;
    color: #334155;
    line-height: 1.6;
    margin: 0 0 .25rem;
}

.cb-text p:last-child {
    margin-bottom: 0;
}

.cb-link {
    color: #1a2a5e;
    text-decoration: underline;
    font-weight: 600;
}

.cb-link:hover {
    color: #2a3f7e;
}

/* ------------------------------------------
   BOTONES DEL BANNER
   Sin dark patterns: todos tienen el mismo
   tamaño, peso de fuente y accesibilidad.
   ------------------------------------------ */
.cb-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cb-btn {
    padding: .7rem 1.5rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #1a2a5e;
    transition: all .25s ease;
    white-space: nowrap;
    text-align: center;
    min-width: 140px;
    line-height: 1.3;
}

/* Aceptar y Rechazar: MISMA jerarquía visual */
.cb-btn-accept {
    background: #1a2a5e;
    color: #fff;
}

.cb-btn-accept:hover {
    background: #2a3f7e;
    border-color: #2a3f7e;
}

.cb-btn-reject {
    background: #fff;
    color: #1a2a5e;
}

.cb-btn-reject:hover {
    background: #f1f5f9;
}

.cb-btn-config {
    background: transparent;
    color: #1a2a5e;
    border-color: #cbd5e1;
}

.cb-btn-config:hover {
    border-color: #1a2a5e;
    background: #f8fafc;
}

/* Focus visible para accesibilidad */
.cb-btn:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* ------------------------------------------
   PANEL DE CONFIGURACIÓN
   ------------------------------------------ */
.cp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 29, 69, .5);
    opacity: 0;
    transition: opacity .3s ease;
}

.cp-overlay-visible {
    opacity: 1;
}

.cp {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.95);
    z-index: 10001;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    opacity: 0;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cp-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.cp-header h3 {
    font-size: 1.1rem;
    color: #1a2a5e;
    margin: 0;
}

.cp-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    font-size: 1.4rem;
    color: #64748b;
    cursor: pointer;
    transition: all .2s;
    line-height: 1;
}

.cp-close:hover {
    background: #e2e8f0;
    color: #1a2a5e;
}

.cp-body {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.cp-category {
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.cp-category:last-child {
    border-bottom: none;
}

.cp-cat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.cp-cat-info {
    flex: 1;
}

.cp-cat-info h4 {
    font-size: .95rem;
    color: #1a2a5e;
    margin: 0 0 .3rem;
}

.cp-cat-info p {
    font-size: .82rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* ------------------------------------------
   TOGGLE SWITCH
   ------------------------------------------ */
.cp-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-top: 2px;
}

.cp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cp-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: all .3s ease;
}

.cp-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.cp-toggle input:checked + .cp-slider {
    background: #1a2a5e;
}

.cp-toggle input:checked + .cp-slider::before {
    transform: translateX(22px);
}

.cp-toggle input:focus-visible + .cp-slider {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* Toggle deshabilitado (esenciales) */
.cp-toggle-disabled .cp-slider {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: .7;
}

.cp-toggle-disabled input:checked + .cp-slider {
    background: #94a3b8;
}

/* ------------------------------------------
   FOOTER DEL PANEL
   ------------------------------------------ */
.cp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
    flex-wrap: wrap;
}

.cp-policy-link {
    font-size: .82rem;
    color: #1a2a5e;
    text-decoration: underline;
    font-weight: 500;
}

.cp-policy-link:hover {
    color: #2a3f7e;
}

/* ------------------------------------------
   BOTÓN FLOTANTE DE CONFIGURACIÓN
   (aparece tras decidir, esquina inferior izq.)
   ------------------------------------------ */
.cb-settings-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 89;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1a2a5e;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(26, 42, 94, .3);
    transition: all .3s ease;
    opacity: .7;
}

.cb-settings-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(26, 42, 94, .4);
}

.cb-settings-btn svg {
    width: 20px;
    height: 20px;
}

/* ------------------------------------------
   RESPONSIVE
   ------------------------------------------ */
@media (max-width: 600px) {
    .cb-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1rem;
    }

    .cb-actions {
        flex-direction: column;
    }

    .cb-btn {
        width: 100%;
        min-width: unset;
    }

    .cp {
        width: 95%;
        max-height: 90vh;
    }

    .cp-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .cp-footer .cb-btn {
        width: 100%;
    }
}

/* ------------------------------------------
   PRINT: ocultar todo
   ------------------------------------------ */
@media print {
    .cb,
    .cp,
    .cp-overlay,
    .cb-settings-btn {
        display: none !important;
    }
}
