/* =============================================================================
   Quíntuple PLV - Cookie Consent Banner & Settings Modal 2026
   Conforme con RGPD, LOPDGDD y Guía de Cookies AEPD (CEPD)
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Banner Flotante de Consentimiento
   ----------------------------------------------------------------------------- */
.cookie-banner-wrapper {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 999990;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner-wrapper.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-banner-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 16px 36px -10px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cookie-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.15);
}

.cookie-banner-body {
    flex: 1;
    min-width: 0;
    line-height: 1.45;
}

.cookie-banner-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 4px 0 0;
    display: inline;
}

.cookie-banner-text {
    font-size: 0.82rem;
    line-height: 1.45;
    color: #475569;
    margin: 0;
    display: inline;
}

.cookie-banner-text a {
    color: #0284c7;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.cookie-banner-text a:hover {
    color: #0369a1;
}

.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* Botones con el mismo nivel de facilidad y presencia visual */
.cookie-btn {
    appearance: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.81rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.cookie-btn-accept {
    background: var(--brand-primary, #005D93);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 93, 147, 0.22);
}

.cookie-btn-accept:hover {
    background: var(--brand-primary-hover, #004873);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 93, 147, 0.32);
}

.cookie-btn-reject {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.cookie-btn-reject:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.cookie-btn-settings {
    background: transparent;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.cookie-btn-settings:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

/* -----------------------------------------------------------------------------
   2. Modal de Configuración y Preferencias
   ----------------------------------------------------------------------------- */
.cookie-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.cookie-modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg, 16px);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
    border: 1px solid #e2e8f0;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

.cookie-modal-overlay.is-open .cookie-modal-card {
    transform: scale(1);
}

.cookie-modal-header {
    padding: 22px 28px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.cookie-modal-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cookie-modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cookie-modal-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.cookie-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s ease;
}

.cookie-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cookie-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

.cookie-modal-intro {
    font-size: 0.86rem;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 20px 0;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
}

.cookie-group-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cookie-group-item {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md, 12px);
    padding: 18px 20px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cookie-group-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.cookie-group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.cookie-group-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.cookie-group-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.35;
}

.cookie-badge-status {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cookie-badge-status.required {
    background: #dbeafe;
    color: #1e40af;
}

.cookie-badge-status.optional {
    background: #f1f5f9;
    color: #475569;
}

.cookie-group-desc {
    font-size: 0.82rem;
    line-height: 1.5;
    color: #64748b;
    margin: 0;
}

/* Switch Toggle iOS Style */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    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: #cbd5e1;
    transition: .25s ease;
    border-radius: 26px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-switch input:checked + .cookie-slider {
    background-color: var(--brand-primary, #005D93);
}

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

.cookie-switch input:disabled + .cookie-slider {
    background-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.8;
}

.cookie-modal-footer {
    padding: 18px 28px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.cookie-modal-footer-left {
    display: flex;
    gap: 8px;
}

.cookie-modal-footer-right {
    display: flex;
    gap: 8px;
}

/* -----------------------------------------------------------------------------
   3. Botón Flotante para Reabrir Preferencias
   ----------------------------------------------------------------------------- */
.cookie-floating-trigger {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 99990;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-floating-trigger:hover {
    background: var(--brand-primary, #005D93);
    color: #ffffff;
    border-color: var(--brand-primary, #005D93);
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(0, 93, 147, 0.28);
}

/* -----------------------------------------------------------------------------
   4. Adaptación Responsive (Móvil / Pantallas pequeñas)
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .cookie-banner-wrapper {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }

    .cookie-banner-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 12px;
    }

    .cookie-banner-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .cookie-banner-actions .cookie-btn {
        width: 100%;
        padding: 8px 14px;
    }

    /* Modal Mobile Styling */
    .cookie-modal-overlay {
        padding: 12px;
    }

    .cookie-modal-card {
        max-height: 92vh;
        border-radius: var(--radius-lg, 16px);
    }

    .cookie-modal-header {
        padding: 16px 18px;
    }

    .cookie-modal-body {
        padding: 16px 14px;
    }

    .cookie-group-item {
        padding: 14px 14px;
        border-radius: 12px;
    }

    .cookie-group-header {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 8px;
    }

    .cookie-group-title-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        flex: 1;
        min-width: 0;
    }

    .cookie-group-name {
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .cookie-badge-status {
        font-size: 0.68rem;
        padding: 2px 7px;
    }

    .cookie-group-desc {
        font-size: 0.8rem;
        line-height: 1.45;
    }

    .cookie-modal-footer {
        padding: 14px 16px;
        flex-direction: column-reverse;
        gap: 10px;
    }

    .cookie-modal-footer-left,
    .cookie-modal-footer-right {
        width: 100%;
        flex-direction: column;
    }

    .cookie-modal-footer .cookie-btn {
        width: 100%;
    }
}

