/* ============================================
   COOKIES.CSS - Popup, modal, banners
   Diario Costa Tropical
   ============================================ */

/* ============================================
   BANNER FLOTANTE MÓVIL
   ============================================ */
.banner-flotante-movil {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9998;
    background: #ffffff;
    padding: 0;
    margin: 0;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

@media (max-width: 768px) {
    .banner-flotante-movil { display: block; }

    .banner-flotante-movil.visible {
        transform: translateY(0);
        opacity: 1;
    }

    .banner-flotante-wrapper {
        position: relative;
        width: 100%;
        margin: 0;
        padding: 0;
        background: #ffffff;
        line-height: 0;
    }

    .banner-flotante-movil .banner-flotante-link {
        display: block;
        width: 100%;
        margin: 0;
        padding: 10px;
        text-decoration: none;
        background: #ffffff;
        box-sizing: border-box;
        line-height: 0;
        text-align: center;
    }

    .banner-flotante-movil .banner-flotante-link a {
        display: block;
        width: 100%;
        text-decoration: none;
        line-height: 0;
    }

    .banner-flotante-movil .banner-flotante-link img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 90px;
        object-fit: contain;
        display: block;
        margin: 0 auto !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
    }

    .banner-flotante-close {
        position: absolute;
        top: -30px;
        right: 0;
        z-index: 10000;
        background: #ffffff;
        border: 1px solid rgba(0,0,0,0.15);
        color: #000000;
        width: 30px;
        height: 30px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px 6px 0 0;
        padding: 0;
        box-shadow: 0 -2px 6px rgba(0,0,0,0.08);
        transition: background 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .banner-flotante-close:hover,
    .banner-flotante-close:active { background: #f0f0f0; }

    .banner-flotante-close svg {
        width: 14px;
        height: 14px;
        stroke: #000000;
        display: block;
    }

    .banner-flotante-movil.oculto { display: none !important; }

    .banner-flotante-movil.cerrando {
        animation: bannerFlotanteSalida 0.3s ease forwards;
    }

    @keyframes bannerFlotanteSalida {
        0%   { transform: translateY(0); opacity: 1; }
        100% { transform: translateY(100%); opacity: 0; }
    }
}

/* ============================================
   COOKIES POPUP
   ============================================ */
.cookies-popup {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--primary, #0d1b2a);
    color: #e8e8e8;
    padding: 16px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    transition: bottom 0.5s ease;
    font-family: var(--font-primary, 'Inter', sans-serif);
    border-top: 2px solid #007887;
}

.cookies-popup.show { bottom: 0; }

.cookies-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
}

.cookies-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e8e8e8;
}

.cookies-text strong { color: #ffffff; }
.cookies-text a { color: #00b3c9; text-decoration: underline; }
.cookies-text a:hover { color: #33d4e8; }

.cookies-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.btn-cookie {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
    font-family: inherit;
}

.btn-accept { background: #007887; color: #fff; }
.btn-accept:hover { background: #005f6b; transform: translateY(-1px); }

.btn-config {
    background: transparent;
    color: #d8d8d8;
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-config:hover { background: rgba(255,255,255,0.1); }

.btn-reject {
    background: transparent;
    color: #cccccc;
    border: 1px solid rgba(255,255,255,0.12);
}
.btn-reject:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ============================================
   COOKIES MODAL
   ============================================ */
.cookies-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.cookies-modal.show { display: flex; }

.modal-content {
    background: #fff;
    max-width: 520px;
    width: 90%;
    padding: 30px 28px;
    border-radius: var(--radius, 8px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    font-family: var(--font-primary, 'Inter', sans-serif);
    max-height: 90vh;
    overflow-y: auto;
    border-top: 4px solid #007887;
}

.modal-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px 0;
}

.modal-content > p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cookie-option:last-child { border-bottom: none; }

.cookie-info { flex: 1; }

.cookie-name { font-size: 0.95rem; font-weight: 600; color: #1a1a1a; }
.cookie-desc { font-size: 0.8rem; color: #777; }

.cookie-toggle { flex-shrink: 0; margin-left: 15px; }
.cookie-toggle input[type="checkbox"] { display: none; }

.cookie-toggle .slider {
    display: block;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
    position: relative;
}

.cookie-toggle .slider::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition, all 0.3s ease);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cookie-toggle input:checked + .slider { background: #007887; }
.cookie-toggle input:checked + .slider::after { transform: translateX(20px); }
.cookie-toggle input:disabled + .slider { opacity: 0.6; cursor: not-allowed; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.btn-modal {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
    font-family: inherit;
}

.btn-close { background: #f0f0f0; color: #555; }
.btn-close:hover { background: #e0e0e0; }
.btn-save { background: #007887; color: #fff; }
.btn-save:hover { background: #005f6b; transform: translateY(-1px); }

/* ============================================
   PWA INSTALL BANNER
   ============================================ */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 14px 16px;
    z-index: 9997;
    transform: translateY(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e0e0e0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.pwa-install-banner.visible {
    transform: translateY(0);
}
.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pwa-banner-icon img {
    border-radius: 10px;
    display: block;
}
.pwa-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.pwa-banner-text strong {
    font-size: 0.9rem;
    color: #1a1a2e;
    font-weight: 700;
}
.pwa-banner-text span {
    font-size: 0.78rem;
    color: #6b6b7a;
    line-height: 1.3;
}
.pwa-banner-install {
    background: #007887;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.pwa-banner-install:hover {
    background: #005f6b;
}
.pwa-banner-close {
    background: none;
    border: none;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}
.pwa-banner-close:hover {
    color: #333;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .cookies-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .cookies-text { font-size: 0.85rem; }
    .cookies-actions { justify-content: center; }
    .btn-cookie {
        padding: 6px 14px;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }
    .modal-content { padding: 22px 18px; width: 95%; }
    .cookie-option { flex-wrap: wrap; gap: 6px; }
    .cookie-toggle { margin-left: 0; }
    .modal-actions { flex-direction: column-reverse; }
    .btn-modal { width: 100%; text-align: center; padding: 12px; }

    .pwa-install-banner {
        bottom: 100px;
        left: 12px;
        right: 12px;
        padding: 12px;
    }
    .pwa-banner-text strong { font-size: 0.85rem; }
    .pwa-banner-text span { font-size: 0.72rem; }
    .pwa-banner-install { padding: 7px 12px; font-size: 0.78rem; }
}

@media (max-width: 480px) {
    .cookies-text { font-size: 0.8rem; }
    .btn-cookie { font-size: 0.75rem; padding: 5px 10px; }
    .modal-content h3 { font-size: 1.1rem; }
}