/**
 * Xenogene Cookie Consent System - RGPD/GDPR Compliant
 * Estilos para banner y modal de consentimiento de cookies
 * Colores de marca: #068aa9 (azul), #ee8c1d (naranja), #2c8697 (teal)
 */

/* ========================================
   VARIABLES Y RESET
   ======================================== */

:root {
    --xeno-blue: #068aa9;
    --xeno-orange: #ee8c1d;
    --xeno-teal: #2c8697;
    --xeno-dark: #2c2c2c;
    --xeno-gray: #6b7280;
    --xeno-light-gray: #f3f4f6;
    --consent-overlay-bg: rgba(0, 0, 0, 0.75);
    --consent-white: #ffffff;
    --consent-border: #e5e7eb;
    --consent-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --consent-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BANNER DE CONSENTIMIENTO
   ======================================== */

#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--consent-white);
    border-top: 3px solid var(--xeno-blue);
    box-shadow: var(--consent-shadow);
    z-index: 9999;
    animation: slideInUp 0.4s ease-out;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#cookie-consent-banner.hidden {
    display: none;
}

.consent-banner-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.consent-banner-icon {
    font-size: 36px;
    color: var(--xeno-blue);
    flex-shrink: 0;
}

.consent-banner-content {
    flex: 1;
    min-width: 0;
}

.consent-banner-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--xeno-dark);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.consent-banner-text {
    font-size: 14px;
    color: var(--xeno-gray);
    line-height: 1.6;
    margin: 0;
}

.consent-banner-text a {
    color: var(--xeno-blue);
    text-decoration: underline;
    font-weight: 500;
}

.consent-banner-text a:hover {
    color: var(--xeno-teal);
}

.consent-banner-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

/* ========================================
   BOTONES DEL BANNER
   ======================================== */

.consent-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.consent-btn:focus {
    outline: 3px solid rgba(6, 138, 169, 0.3);
    outline-offset: 2px;
}

.consent-btn-reject {
    background: var(--xeno-light-gray);
    color: var(--xeno-dark);
    border: 1px solid var(--consent-border);
}

.consent-btn-reject:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.consent-btn-configure {
    background: transparent;
    color: var(--xeno-blue);
    border: 2px solid var(--xeno-blue);
}

.consent-btn-configure:hover {
    background: rgba(6, 138, 169, 0.1);
    transform: translateY(-1px);
}

.consent-btn-accept {
    background: var(--xeno-orange);
    color: var(--consent-white);
    box-shadow: 0 4px 12px rgba(238, 140, 29, 0.3);
}

.consent-btn-accept:hover {
    background: #d67a15;
    box-shadow: 0 6px 16px rgba(238, 140, 29, 0.4);
    transform: translateY(-2px);
}

/* ========================================
   MODAL DE CONFIGURACIÓN
   ======================================== */

#cookie-consent-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#cookie-consent-modal.hidden {
    display: none;
}

.consent-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--consent-overlay-bg);
    backdrop-filter: blur(4px);
}

.consent-modal-container {
    position: relative;
    background: var(--consent-white);
    border-radius: 16px;
    box-shadow: var(--consent-shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal Header */
.consent-modal-header {
    padding: 28px 32px;
    border-bottom: 2px solid var(--xeno-blue);
    background: linear-gradient(135deg, rgba(6, 138, 169, 0.05) 0%, rgba(238, 140, 29, 0.05) 100%);
}

.consent-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--xeno-dark);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.consent-modal-title i {
    color: var(--xeno-blue);
    font-size: 28px;
}

.consent-modal-description {
    font-size: 14px;
    color: var(--xeno-gray);
    margin: 0;
    line-height: 1.6;
}

/* Modal Body */
.consent-modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.consent-category {
    padding: 20px;
    margin-bottom: 16px;
    border: 2px solid var(--consent-border);
    border-radius: 12px;
    background: var(--consent-white);
    transition: all 0.3s ease;
}

.consent-category:hover {
    border-color: var(--xeno-blue);
    box-shadow: 0 4px 12px rgba(6, 138, 169, 0.1);
}

.consent-category.required {
    background: var(--xeno-light-gray);
    border-color: var(--xeno-gray);
}

.consent-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.consent-category-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--xeno-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.consent-category-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--xeno-blue);
    color: var(--consent-white);
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.consent-category-description {
    font-size: 14px;
    color: var(--xeno-gray);
    line-height: 1.6;
    margin: 0;
}

/* Custom Checkbox */
.consent-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.consent-toggle input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.consent-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    border-radius: 28px;
    transition: all 0.3s ease;
}

.consent-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--consent-white);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.consent-toggle input:checked + .consent-toggle-slider {
    background: var(--xeno-blue);
}

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

.consent-toggle input:disabled + .consent-toggle-slider {
    background: var(--xeno-gray);
    cursor: not-allowed;
}

.consent-toggle input:focus + .consent-toggle-slider {
    box-shadow: 0 0 0 3px rgba(6, 138, 169, 0.3);
}

/* Modal Footer */
.consent-modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--consent-border);
    background: var(--xeno-light-gray);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.consent-modal-footer .consent-btn {
    min-width: 140px;
    justify-content: center;
}

.consent-modal-links {
    padding: 16px 32px;
    border-top: 1px solid var(--consent-border);
    background: var(--consent-white);
    text-align: center;
    font-size: 13px;
}

.consent-modal-links a {
    color: var(--xeno-blue);
    text-decoration: none;
    font-weight: 500;
    margin: 0 12px;
}

.consent-modal-links a:hover {
    text-decoration: underline;
    color: var(--xeno-teal);
}

/* ========================================
   BOTÓN FLOTANTE DE CONFIGURACIÓN
   ======================================== */

.cookie-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--xeno-blue);
    color: var(--consent-white);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(6, 138, 169, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-settings-btn:hover {
    background: var(--xeno-teal);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 16px rgba(6, 138, 169, 0.6);
}

.cookie-settings-btn:focus {
    outline: 3px solid rgba(6, 138, 169, 0.3);
    outline-offset: 2px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablets */
@media (max-width: 968px) {
    .consent-banner-container {
        padding: 20px 24px;
        gap: 20px;
    }

    .consent-banner-icon {
        font-size: 32px;
    }

    .consent-banner-actions {
        flex-wrap: wrap;
    }

    .consent-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .consent-modal-container {
        max-width: 500px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .consent-banner-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 16px;
    }

    .consent-banner-icon {
        align-self: center;
    }

    .consent-banner-content {
        text-align: center;
    }

    .consent-banner-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .consent-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }

    .consent-modal-container {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }

    .consent-modal-header,
    .consent-modal-body,
    .consent-modal-footer {
        padding: 20px;
    }

    .consent-modal-title {
        font-size: 20px;
    }

    .consent-category {
        padding: 16px;
    }

    .consent-modal-footer {
        flex-direction: column;
    }

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

    .cookie-settings-btn {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .consent-banner-title {
        font-size: 16px;
    }

    .consent-banner-text {
        font-size: 13px;
    }

    .consent-btn {
        font-size: 13px;
        padding: 10px 16px;
    }

    .consent-modal-title {
        font-size: 18px;
    }

    .consent-category-title {
        font-size: 14px;
    }

    .consent-category-description {
        font-size: 13px;
    }
}

/* ========================================
   DARK MODE SUPPORT (Opcional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --xeno-dark: #f3f4f6;
        --xeno-gray: #9ca3af;
        --xeno-light-gray: #1f2937;
        --consent-white: #111827;
        --consent-border: #374151;
        --consent-overlay-bg: rgba(0, 0, 0, 0.85);
    }

    #cookie-consent-banner {
        border-top-color: var(--xeno-teal);
    }

    .consent-modal-header {
        background: linear-gradient(135deg, rgba(6, 138, 169, 0.1) 0%, rgba(238, 140, 29, 0.1) 100%);
    }

    .consent-category {
        background: #1f2937;
    }

    .consent-category.required {
        background: #374151;
    }

    .consent-btn-reject {
        background: #374151;
        color: var(--xeno-light-gray);
        border-color: #4b5563;
    }

    .consent-btn-reject:hover {
        background: #4b5563;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    #cookie-consent-banner,
    #cookie-consent-modal,
    .cookie-settings-btn {
        display: none !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Mejora de contraste para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible mejorado */
*:focus-visible {
    outline: 3px solid var(--xeno-blue);
    outline-offset: 2px;
}

/* Animaciones reducidas para usuarios con preferencia */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
