/* Variables de color y diseño (personaliza aquí) */
:root {
    --cookie-bg: #1a1a2e;
    --cookie-bg-modal: #ffffff;
    --cookie-text: #e0e0e0;
    --cookie-text-modal: #333333;
    --cookie-accent: #0B6B2B;
    --cookie-accent-hover: #26b857;
    --cookie-border: rgba(255, 255, 255, 0.1);
    --cookie-border-modal: #e5e5e5;
    --cookie-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
    --cookie-radius: 12px;
    --cookie-toggle-on: #0B6B2B;
    --cookie-toggle-off: #cccccc;
    --cookie-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --cookie-z: 99999;
}

/* ============================================================
   BANNER PRINCIPAL (barra inferior)
   ============================================================ */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--cookie-z);
    background: var(--cookie-bg);
    color: var(--cookie-text);
    font-family: var(--cookie-font);
    font-size: 14px;
    box-shadow: var(--cookie-shadow);
    border-top: 1px solid var(--cookie-border);
    
    /* Animación de entrada desde abajo */
    animation: cookieSlideIn 0.4s ease forwards;
}

/* Animación de entrada */
@keyframes cookieSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Estado oculto del banner */
.cookie-banner.cookie-banner--hidden {
    animation: cookieSlideOut 0.3s ease forwards;
}

/* Animación de salida */
@keyframes cookieSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Contenedor interior con máximo de ancho */
.cookie-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Sección informativa: icono + texto */
.cookie-banner__info {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
    min-width: 260px;
}

/* Icono de cookie */
.cookie-banner__icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

/* Texto informativo */
.cookie-banner__text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    color: #ffffff;
}

.cookie-banner__text p {
    margin: 0;
    line-height: 1.5;
    color: var(--cookie-text);
    opacity: 0.85;
}

/* Enlace "Más información" */
.cookie-banner__link {
    color: var(--cookie-accent);
    text-decoration: underline;
    white-space: nowrap;
}

.cookie-banner__link:hover {
    color: var(--cookie-accent-hover);
}

/* Botones de acción del banner */
.cookie-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================
   BOTONES GENERALES
   ============================================================ */

.cookie-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: var(--cookie-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

/* Botón principal (aceptar) */
.cookie-btn--primary {
    background: var(--cookie-accent);
    color: #ffffff;
    border-color: var(--cookie-accent);
}

.cookie-btn--primary:hover {
    background: var(--cookie-accent-hover);
    border-color: var(--cookie-accent-hover);
    transform: translateY(-1px);
}

/* Botón con borde (rechazar) */
.cookie-btn--outline {
    background: transparent;
    color: var(--cookie-text);
    border-color: rgba(255, 255, 255, 0.3);
}

.cookie-btn--outline:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

/* Botón fantasma (configurar) */
.cookie-btn--ghost {
    background: transparent;
    color: #13a845;
    border-color: transparent;
    text-decoration: underline;
    padding-left: 4px;
    padding-right: 4px;
}

.cookie-btn--ghost:hover {
    color: var(--cookie-accent-hover);
    text-decoration: none;
}

/* ============================================================
   MODAL DE CONFIGURACIÓN
   ============================================================ */

.cookie-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--cookie-z) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cookie-font);
    font-size: 14px;
}

/* Fondo oscuro detrás del modal */
.cookie-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

/* Caja del modal */
.cookie-modal__box {
    position: relative;
    z-index: 1;
    background: var(--cookie-bg-modal);
    color: var(--cookie-text-modal);
    border-radius: var(--cookie-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 16px;
    animation: cookieModalIn 0.3s ease;
}

/* Animación de entrada del modal */
@keyframes cookieModalIn {
    from {
        transform: scale(0.95) translateY(-10px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Cabecera del modal */
.cookie-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--cookie-border-modal);
}

.cookie-modal__header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--cookie-text-modal);
}

/* Botón de cierre (X) */
.cookie-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.cookie-modal__close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Cuerpo del modal */
.cookie-modal__body {
    padding: 8px 0;
}

/* Pie del modal */
.cookie-modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--cookie-border-modal);
    text-align: right;
}

/* ============================================================
   OPCIONES DE COOKIE (fila de cada categoría)
   ============================================================ */

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--cookie-border-modal);
}

.cookie-option:last-child {
    border-bottom: none;
}

/* Texto descriptivo de cada categoría */
.cookie-option__info {
    flex: 1;
}

.cookie-option__info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #222;
}

.cookie-option__info p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Contenedor del toggle */
.cookie-option__toggle {
    flex-shrink: 0;
}

/* Texto "Siempre activas" para cookies necesarias */
.cookie-toggle--disabled {
    font-size: 12px;
    font-weight: 600;
    color: #4CAF50;
    white-space: nowrap;
}

/* ============================================================
   SWITCH TOGGLE (interruptor on/off)
   ============================================================ */

/* Ocultar el input real, usar el slider visual */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* Fondo del switch */
.cookie-switch__slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cookie-toggle-off);
    border-radius: 24px;
    transition: background 0.3s ease;
}

/* Círculo del switch */
.cookie-switch__slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Estado activado */
.cookie-switch input:checked + .cookie-switch__slider {
    background: var(--cookie-toggle-on);
}

/* Mover el círculo cuando está activado */
.cookie-switch input:checked + .cookie-switch__slider::before {
    transform: translateX(20px);
}

/* Foco accesible con teclado */
.cookie-switch input:focus + .cookie-switch__slider {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE - Móvil
   ============================================================ */

@media (max-width: 600px) {

    /* El banner se apila en vertical en móvil */
    .cookie-banner__inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
    }

    /* Los botones ocupan todo el ancho */
    .cookie-banner__actions {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
        padding: 11px 16px;
    }

    /* El modal se adapta a pantalla completa en móvil */
    .cookie-modal__box {
        max-height: 95vh;
        margin: 8px;
        border-radius: 10px;
    }

    .cookie-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ============================================================
   PESTAÑA "GESTIONAR COOKIES" - Esquina inferior izquierda
   Visible siempre para cumplir RGPD (el usuario puede cambiar
   sus preferencias en cualquier momento)
   ============================================================ */

.cookie-tab {
    position: fixed;
    bottom: 0;
    left: 24px;
    z-index: calc(var(--cookie-z) - 1);

    /* Aspecto de pestaña: redondeada arriba, pegada abajo */
    background: var(--cookie-bg);
    color: var(--cookie-text);
    border: 1px solid var(--cookie-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;

    /* Tipografía pequeña y discreta */
    font-family: var(--cookie-font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;

    /* Tamaño compacto */
    padding: 6px 12px;
    cursor: pointer;

    /* Oculta por defecto: solo se muestra cuando el banner está cerrado */
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

/* Estado visible */
.cookie-tab--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Hover: sube ligeramente */
.cookie-tab:hover {
    background: #2a2a4a;
    transform: translateY(-2px);
}

/* En móvil, se hace aún más pequeña */
@media (max-width: 600px) {
    .cookie-tab {
        left: 12px;
        font-size: 10px;
        padding: 5px 10px;
    }
}
