/* Cookie Consent Manager Styles - Personalizable con variables CSS */
:root {
    --cookie-primary: #000000;
    --cookie-primary-hover: #333333;
    --cookie-bg: #ffffff;
    --cookie-text: #1f2937;
    --cookie-text-secondary: #6b7280;
    --cookie-border: #e5e7eb;
    --cookie-switch-bg: #d1d5db;
    --cookie-switch-active: var(--cookie-primary);
    --cookie-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --cookie-item-bg-hover: #f9fafb;
    --cookie-radius: 12px;
    --cookie-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ====== BANNER PRINCIPAL ====== */
.cookie-consent-banner {
    position: fixed;
    max-width: 440px;
    width: calc(100% - 32px);
    background: var(--cookie-bg);
    border-radius: var(--cookie-radius);
    box-shadow: var(--cookie-shadow);
    padding: 24px;
    z-index: 2147483646;
    font-family: var(--cookie-font);
    border: 1px solid var(--cookie-border);
    animation: cookieSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cookieSlideIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Posiciones del banner */
.cookie-position-bottom-right { bottom: 24px; right: 24px; }
.cookie-position-bottom-left { bottom: 24px; left: 24px; }
.cookie-position-bottom-center { bottom: 24px; left: 50%; transform: translateX(-50%); }
.cookie-position-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.cookie-position-bottom-full {
    bottom: 0; left: 0; right: 0;
    max-width: none; width: 100%;
    border-radius: var(--cookie-radius) var(--cookie-radius) 0 0;
}

/* Banner oculto */
.cookie-consent-banner.cookie-hidden {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ====== TÍTULOS Y TEXTOS ====== */
.cookie-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--cookie-text);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.cookie-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--cookie-text-secondary);
    margin: 0 0 20px 0;
}

.cookie-description a,
.cookie-item-content a {
    color: var(--cookie-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-description a:hover,
.cookie-item-content a:hover {
    opacity: 0.8;
}

/* ====== ITEMS DE COOKIES (Acordeón) ====== */
.cookie-items {
    max-height: 320px;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

.cookie-item {
    background: var(--cookie-bg);
    border: 1px solid var(--cookie-border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.cookie-item:hover {
    background: var(--cookie-item-bg-hover);
}

.cookie-item.expanded {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cookie-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.cookie-item-header-content {
    flex: 1;
    min-width: 0;
}

.cookie-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--cookie-text);
}

.cookie-item-content {
    font-size: 13px;
    color: var(--cookie-text-secondary);
    line-height: 1.6;
    padding: 0 16px 14px;
    display: none;
    border-top: 1px solid var(--cookie-border);
    margin-top: 0;
    padding-top: 12px;
}

.cookie-item.expanded .cookie-item-content {
    display: block;
}

.cookie-item-arrow {
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cookie-item-arrow::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--cookie-text-secondary);
    border-bottom: 2px solid var(--cookie-text-secondary);
    transform: rotate(45deg);
    top: 4px;
    left: 6px;
}

.cookie-item.expanded .cookie-item-arrow {
    transform: rotate(180deg);
}

.cookie-more-info {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--cookie-primary);
    text-decoration: none;
}

.cookie-more-info:hover {
    text-decoration: underline;
}

/* ====== SWITCH TOGGLE ====== */
.cookie-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.cookie-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--cookie-switch-bg);
    transition: background-color 0.2s ease;
    border-radius: 24px;
}

.cookie-switch-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: transform 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cookie-switch input:checked + .cookie-switch-slider {
    background-color: var(--cookie-switch-active);
}

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

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

.cookie-required-badge {
    font-size: 11px;
    font-weight: 500;
    color: #059669;
    background: #d1fae5;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* ====== BOTONES ====== */
.cookie-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.cookie-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-align: center;
}

.cookie-btn-primary {
    background: var(--cookie-primary);
    color: white;
}

.cookie-btn-primary:hover {
    background: var(--cookie-primary-hover);
}

.cookie-btn-secondary {
    background: #f3f4f6;
    color: var(--cookie-text);
}

.cookie-btn-secondary:hover {
    background: #e5e7eb;
}

.cookie-btn-outline {
    background: transparent;
    border: 1px solid var(--cookie-border);
    color: var(--cookie-text);
}

.cookie-btn-outline:hover {
    background: var(--cookie-item-bg-hover);
    border-color: var(--cookie-text-secondary);
}

/* Botón volver */
.cookie-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cookie-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    transition: color 0.15s ease;
}

.cookie-back-btn:hover {
    color: var(--cookie-primary);
}

.cookie-back-btn svg {
    width: 16px;
    height: 16px;
}

/* ====== VISTAS ====== */
.cookie-view {
    display: block;
}

.cookie-view.cookie-view-hidden {
    display: none;
}

/* ====== BOTÓN FLOTANTE DE CONFIGURACIÓN ====== */
.cookie-config-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: var(--cookie-bg);
    border: 1px solid var(--cookie-border);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 2147483640;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cookie-config-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.cookie-config-btn svg {
    width: 22px;
    height: 22px;
    color: var(--cookie-text-secondary);
}

.cookie-config-btn.cookie-visible {
    display: flex;
}

/* ====== MODAL DE CONFIGURACIÓN ====== */
.cookie-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2147483645;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.cookie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    max-width: 480px;
    width: calc(100% - 32px);
    max-height: calc(100vh - 48px);
    background: var(--cookie-bg);
    border-radius: var(--cookie-radius);
    box-shadow: var(--cookie-shadow);
    z-index: 2147483647;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cookie-modal.cookie-modal-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--cookie-border);
}

.cookie-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--cookie-text);
    margin: 0;
}

.cookie-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--cookie-text-secondary);
    transition: background 0.15s ease;
}

.cookie-modal-close:hover {
    background: var(--cookie-item-bg-hover);
}

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

.cookie-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--cookie-border);
    display: flex;
    gap: 8px;
}

.cookie-modal-footer .cookie-btn {
    flex: 1;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 480px) {
    .cookie-consent-banner {
        width: calc(100% - 24px);
        padding: 20px;
        bottom: 12px;
        right: 12px;
        left: 12px;
    }

    .cookie-position-bottom-right,
    .cookie-position-bottom-left,
    .cookie-position-bottom-center {
        right: 12px;
        left: 12px;
        bottom: 12px;
        transform: none;
    }

    .cookie-buttons {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
    }

    .cookie-modal {
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
    }
}

/* Scrollbar personalizado */
.cookie-items::-webkit-scrollbar,
.cookie-modal-body::-webkit-scrollbar {
    width: 6px;
}

.cookie-items::-webkit-scrollbar-track,
.cookie-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.cookie-items::-webkit-scrollbar-thumb,
.cookie-modal-body::-webkit-scrollbar-thumb {
    background: var(--cookie-border);
    border-radius: 3px;
}

.cookie-items::-webkit-scrollbar-thumb:hover,
.cookie-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--cookie-text-secondary);
}
