/**
 * ==========================================================================
 * GESTOR DE COOKIES A MEDIDA (cookie-manager.css)
 * ==========================================================================
 * Estilos para el Banner emergente y el Modal de Configuración.
 * Soporta Tema Oscuro (por defecto) y Tema Claro.
 * ==========================================================================
 */

/* ================= 1. BANNER FLOTANTE INFERIOR ================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 6, 61, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 2px solid var(--color-verde-acento, #28CC43);
    z-index: 9999;
    padding: 25px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    
    transform: translateY(120%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease, visibility 0.6s ease;
}

.cookie-banner.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

[data-theme="light"] .cookie-banner {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}

.cookie-text {
    color: #ffffff;
    font-size: 1.05rem; 
    line-height: 1.6;
    text-align: center;
    margin-bottom: 25px;
    max-width: 1000px;
}

[data-theme="light"] .cookie-text { color: #000957; }

.cookie-text a {
    color: var(--color-verde-acento, #28CC43);
    text-decoration: none;
    font-weight: bold;
}

.cookie-text a:hover { text-decoration: underline; }

/* ================= 2. BOTONES DEL BANNER Y MODAL ================= */
.cookie-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.cookie-btn {
    padding: 14px 30px; 
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px; 
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1; 
    min-width: 180px; 
}

/* El botón Aceptar ahora tiene un borde del mismo color para que al hacerse transparente no altere su tamaño */
.cookie-btn-accept {
    background-color: var(--color-verde-acento, #28CC43);
    color: #ffffff !important;
    border: 2px solid var(--color-verde-acento, #28CC43);
    box-shadow: 0 4px 15px rgba(40, 204, 67, 0.4);
}

.cookie-btn-accept:hover {
    background-color: #21a836;
    border-color: #21a836;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(40, 204, 67, 0.6);
}

.cookie-btn-reject, .cookie-btn-config {
    background-color: transparent;
    color: var(--color-verde-acento, #28CC43) !important;
    border: 2px solid var(--color-verde-acento, #28CC43);
}

.cookie-btn-reject:hover, .cookie-btn-config:hover {
    background-color: rgba(40, 204, 67, 0.1);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 15px rgba(40, 204, 67, 0.2);
}

.cookie-btn-save {
    width: 100%;
    margin-top: 10px;
}

/* ================= 3. MODAL DE CONFIGURACIÓN ================= */
.cookie-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.cookie-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cookie-modal {
    background-color: #00084d;
    border: 1px solid var(--color-verde-acento, #28CC43);
    width: 90%;
    max-width: 650px; 
    border-radius: 20px;
    padding: 35px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

[data-theme="light"] .cookie-modal {
    background-color: #ffffff;
}

.cookie-modal-overlay.active .cookie-modal {
    transform: scale(1);
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

[data-theme="light"] .cookie-modal-header { border-bottom-color: rgba(0,0,0,0.1); }

.cookie-modal-title {
    color: #ffffff;
    font-size: 1.6rem; 
    font-weight: 800;
    margin: 0;
}

[data-theme="light"] .cookie-modal-title { color: #000957; }

.close-cookie-modal {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-cookie-modal:hover { color: var(--color-verde-acento, #28CC43); }
[data-theme="light"] .close-cookie-modal { color: #000957; }

/* Lista de opciones (Interruptores) */
.cookie-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .cookie-option { border-bottom-color: rgba(0,0,0,0.05); }

.cookie-option-info {
    padding-right: 20px;
}

.cookie-option-info h4 {
    color: var(--color-verde-acento, #28CC43);
    margin: 0 0 5px 0;
    font-size: 1.15rem;
}

.cookie-option-info p {
    color: #aaaaaa;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

[data-theme="light"] .cookie-option-info p { color: #555555; }

/* Interruptor tipo Toggle (iPhone style) */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
    flex-shrink: 0;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555;
    transition: .4s;
    border-radius: 34px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .cookie-slider {
    background-color: var(--color-verde-acento, #28CC43);
}

input:checked + .cookie-slider:before {
    transform: translateX(26px);
}

input:disabled + .cookie-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-modal-footer {
    margin-top: 35px;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
 * ADAPTACIÓN RESPONSIVA (MÓVILES VS ESCRITORIO)
 * ========================================================================== */
@media (min-width: 992px) {
    .cookie-banner { 
        flex-direction: row; 
        text-align: left; 
        align-items: center;
        justify-content: space-between;
    }
    
    /* MEJORA 1: Texto Justificado, con guiones y protección de espacio */
    .cookie-text { 
        text-align: justify;
        text-align-last: left;
        hyphens: auto;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        overflow-wrap: break-word;
        word-spacing: -0.05em;
        margin-bottom: 0; 
        margin-right: 40px; /* Margen de seguridad estricto */
        flex: 1 1 auto; /* Permite estirarse pero cediendo el espacio a los botones */
        max-width: none;
    }
    
    /* MEJORA 2: Botones inamovibles */
    .cookie-buttons {
        width: auto;
        flex-wrap: nowrap;
        flex: 0 0 auto; /* Prohíbe que el texto empuje o encoja a los botones */
    }
    
    .cookie-btn {
        flex: none; 
        min-width: auto;
    }

    /* MEJORA 3: "Transferencia de Energía" (Smart Hover Logic) */
    
    /* Si el usuario pasa el ratón por la caja de botones, y NO está sobre el botón Aceptar, este pierde su brillo */
    .cookie-buttons:hover .cookie-btn-accept:not(:hover) {
        background-color: transparent;
        color: var(--color-verde-acento, #28CC43) !important;
        box-shadow: none;
        transform: none;
        border-color: var(--color-verde-acento, #28CC43);
    }
    
    /* El botón que está siendo tocado actualmente recibe todo el brillo verde */
    .cookie-buttons .cookie-btn:hover {
        background-color: #21a836 !important;
        border-color: #21a836 !important;
        color: #ffffff !important;
        box-shadow: 0 6px 20px rgba(40, 204, 67, 0.6) !important;
        transform: translateY(-3px) scale(1.05);
    }
}
