/* ═══════════════════════════════════════════════════════════════
   css/cookie_banner.css
   Banner de cookies conforme AEPD + GDPR + Consent Mode v2.
   ═══════════════════════════════════════════════════════════════ */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, calc(100% + 40px));
  width: min(760px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  z-index: 10000;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s ease;
  font-family: system-ui, -apple-system, sans-serif;
}

.cookie-banner.is-open {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.cookie-banner-inner {
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.cookie-banner-content {
  flex: 1 1 320px;
  min-width: 0;
}

.cookie-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cookie-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
}

.cookie-text a {
  color: #3b82f6;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}

.cookie-btn-primary {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.cookie-btn-primary:hover { background: #2563eb; border-color: #2563eb; }

.cookie-btn-secondary {
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}
.cookie-btn-secondary:hover { background: #f8fafc; border-color: #94a3b8; }

/* ─── Panel de configuración ─────────────────────────────── */

.cookie-config {
  border-top: 1px solid #e2e8f0;
  padding: 20px 24px;
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
  animation: cookieConfigIn 0.2s ease;
}

@keyframes cookieConfigIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cookie-config-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.cookie-category {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.cookie-category-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cookie-category-info {
  flex: 1;
  min-width: 0;
}

.cookie-category-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.cookie-category-info p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

/* ─── Switch toggle ─────────────────────────────────────── */

.cookie-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.cookie-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cookie-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: background 0.2s;
}

.cookie-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.cookie-switch input:checked + .cookie-slider { background: #3b82f6; }
.cookie-switch input:checked + .cookie-slider::before { transform: translateX(18px); }

.cookie-switch input:disabled + .cookie-slider {
  background: #94a3b8;
  cursor: not-allowed;
  opacity: 0.75;
}

.cookie-config-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* ─── Botón flotante para reabrir ───────────────────────── */

.cookie-reopen {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  cursor: pointer;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  font-family: inherit;
}

.cookie-reopen:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.14);
  background: #f8fafc;
}

.cookie-reopen[hidden] { display: none; }

/* ─── Móvil ─────────────────────────────────────────────── */

@media (max-width: 640px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    transform: translate(0, calc(100% + 40px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
  .cookie-banner.is-open { transform: translate(0, 0); }

  .cookie-banner-inner {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-actions { flex-direction: column-reverse; }
  .cookie-actions .cookie-btn { width: 100%; }

  .cookie-config { padding: 16px; }
  .cookie-config-actions { flex-direction: column-reverse; }
  .cookie-config-actions .cookie-btn { width: 100%; }

  .cookie-reopen {
    left: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* ─── Accesibilidad ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-reopen,
  .cookie-slider,
  .cookie-slider::before {
    transition: none;
  }
}