/* =========================================================
   cookie-consent.css  —  Responsive (mobile-first)
   ========================================================= */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --cc-radius:    12px;
  --cc-radius-sm: 8px;
  --cc-shadow:    0 4px 24px rgba(0,0,0,.12), 0 1px 6px rgba(0,0,0,.08);
  --cc-z-banner:  9990;
  --cc-z-modal:   9999;
  --cc-duration:  .22s;

  --cc-bg:        #ffffff;
  --cc-bg-alt:    #f7f7f5;
  --cc-border:    rgba(0,0,0,.1);
  --cc-text:      #1a1a18;
  --cc-text-muted:#6b6b67;
  --cc-primary:   #5c88da;
  --cc-primary-fg:#ffffff;
  --cc-toggle-on: #1a1a18;
  --cc-toggle-off:#d0cfc8;

  /* 👇 AÑADE ESTO */
  --cc-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
             "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji",
             "Segoe UI Emoji";

}

@media (prefers-color-scheme: dark) {
  :root {
    --cc-bg:        #1e1e1c;
    --cc-bg-alt:    #2a2a28;
    --cc-border:    rgba(255,255,255,.1);
    --cc-text:      #f0efe8;
    --cc-text-muted:#9c9a92;
    --cc-primary:   #f0efe8;
    --cc-primary-fg:#1e1e1c;
    --cc-toggle-on: #f0efe8;
    --cc-toggle-off:#444442;
  }
}


/* ── Reset mínimo ───────────────────────────────────────── */
.cc-banner *, .cc-modal * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* 👇 AÑADE ESTO */
  font-family: var(--cc-font);
}



/* =========================================================
   BANNER — mobile first
   ========================================================= */
.cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--cc-z-banner);
  background: var(--cc-bg);
  border-top: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow);
  /* Espacio generoso en móvil para no tapar contenido */
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  animation: cc-slide-up var(--cc-duration) ease-out;
}

@keyframes cc-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.cc-banner[hidden] { display: none; }

/* Apilado en columna por defecto (móvil) */
.cc-banner__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cc-banner__text {
  width: 100%;
}

.cc-banner__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--cc-text);
  margin-bottom: 5px;
}

.cc-banner__text p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--cc-text-muted);
}

/* Botones en columna en móvil */
.cc-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* Tablet ≥ 600px: texto y botones en fila */
@media (min-width: 600px) {
  .cc-banner {
    padding: 18px 24px;
  }
  .cc-banner__inner {
    flex-direction: row;
    align-items: center;
    gap: 20px;
  }
  .cc-banner__text {
    flex: 1 1 0;
    min-width: 0;
  }
  .cc-banner__title {
    font-size: 15px;
  }
  .cc-banner__text p {
    font-size: 13px;
  }
  .cc-banner__actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    flex-shrink: 0;
  }
}

/* Desktop ≥ 960px: botones en una sola línea */
@media (min-width: 960px) {
  .cc-banner {
    padding: 20px 32px;
  }
  .cc-banner__actions {
    flex-wrap: nowrap;
  }
}

/* =========================================================
   BOTONES
   ========================================================= */
.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* Altura mínima táctil: 44px recomendado por WCAG */
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--cc-radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--cc-duration), color var(--cc-duration),
              border-color var(--cc-duration), opacity var(--cc-duration);
  white-space: nowrap;
  width: 100%; /* ocupa todo el ancho en móvil */
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 600px) {
  .cc-btn {
    width: auto;
    min-height: 36px;
    padding: 9px 18px;
  }
}

.cc-btn--primary {
  background: var(--cc-primary);
  color: var(--cc-primary-fg);
  border-color: var(--cc-primary);
  gap: 10px;
}
.cc-btn--primary:hover  { opacity: .85; }
.cc-btn--primary:active { opacity: .7;  }


/* Icono SVG dentro del botón */
.cc-btn__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
}


.cc-btn--secondary {
  background: transparent;
  color: var(--cc-text);
  border-color: var(--cc-border);
}
.cc-btn--secondary:hover  { background: var(--cc-bg-alt); }
.cc-btn--secondary:active { background: var(--cc-border); }


/*
.cc-btn--ghost {
  background: transparent;
  color: var(--cc-text-muted);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 2px;
}
*/


/*
.cc-btn--ghost {
   background: var(--cc-bg-alt);
  color: var(--cc-text);
  border-color: var(--cc-border);
}


.cc-btn--ghost:hover  { color: var(--cc-text); background: var(--cc-toggle-off);}
.cc-btn--ghost:active { opacity: .7; }
*/




.cc-btn--ghost {
  background: var(--cc-primary);
  color: var(--cc-primary-fg);
  border-color: var(--cc-primary);
  gap: 10px;
}
.cc-btn--ghost:hover  { opacity: .85; }
.cc-btn--ghost:active { opacity: .7;  }




/* Orden visual en móvil: primero "Aceptar" (acción principal) */
.cc-btn--primary   { order: 1; }
.cc-btn--secondary { order: 2; }
.cc-btn--ghost     { order: 3; }

@media (min-width: 600px) {
  /* En tablet/desktop restablecemos el orden del HTML */
  .cc-btn--primary,
  .cc-btn--secondary,
  .cc-btn--ghost { order: unset; }
}

/* ── Enlace ─────────────────────────────────────────────── */
.cc-link {
  color: var(--cc-text);
  font-weight: 500;
  text-underline-offset: 2px;
}

/* =========================================================
   MODAL — mobile first
   ========================================================= */
.cc-modal[hidden] { display: none; }

.cc-modal {
  position: fixed;
  inset: 0;
  z-index: var(--cc-z-modal);
  display: flex;
  align-items: flex-end;   /* en móvil sube desde abajo */
  justify-content: center;
  padding: 0;
}

.cc-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: cc-fade-in var(--cc-duration) ease;
}

@keyframes cc-fade-in { from { opacity: 0; } }

/* En móvil ocupa todo el ancho, altura máxima */
.cc-modal__box {
  position: relative;
  z-index: 1;
  background: var(--cc-bg);
  /* Esquinas redondeadas solo arriba en móvil (bottom sheet) */
  border-radius: var(--cc-radius) var(--cc-radius) 0 0;
  box-shadow: var(--cc-shadow);
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: cc-sheet-up var(--cc-duration) cubic-bezier(.34,1.1,.64,1);
  /* Respeta la barra de navegación en móviles iOS/Android */
  padding-bottom: env(safe-area-inset-bottom);
}

@keyframes cc-sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Tablet ≥ 600px: centrado como modal clásico */
@media (min-width: 600px) {
  .cc-modal {
    align-items: center;
    padding: 16px;
  }
  .cc-modal__box {
    border-radius: var(--cc-radius);
    max-width: 520px;
    max-height: 88vh;
    animation: cc-scale-in var(--cc-duration) cubic-bezier(.34,1.3,.64,1);
    padding-bottom: 0;
  }
  @keyframes cc-scale-in {
    from { transform: scale(.93); opacity: 0; }
  }
}

/* ── Header del modal ───────────────────────────────────── */
.cc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--cc-border);
  /* Handle visual en móvil (bottom sheet) */
  position: relative;
}

/* Línea de arrastre en móvil */
.cc-modal__header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: var(--cc-border);
  border-radius: 2px;
}

@media (min-width: 600px) {
  .cc-modal__header {
    padding: 20px 24px 16px;
  }
  .cc-modal__header::before {
    display: none;
  }
}

.cc-modal__header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--cc-text);
  padding-top: 8px; /* espacio para la línea de arrastre */
}

@media (min-width: 600px) {
  .cc-modal__header h2 {
    font-size: 16px;
    padding-top: 0;
  }
}

.cc-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cc-text-muted);
  /* Área táctil mínima 44px */
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  transition: color var(--cc-duration), background var(--cc-duration);
  -webkit-tap-highlight-color: transparent;
}
.cc-modal__close:hover {
  color: var(--cc-text);
  background: var(--cc-bg-alt);
}

@media (min-width: 600px) {
  .cc-modal__close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-top: 0;
  }
}

/* ── Body del modal ─────────────────────────────────────── */
.cc-modal__body {
  overflow-y: auto;
  padding: 4px 20px;
  flex: 1;
  /* Scroll suave en iOS */
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 600px) {
  .cc-modal__body {
    padding: 4px 24px;
  }
}

/* ── Footer del modal ───────────────────────────────────── */
.cc-modal__footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--cc-border);
}

@media (min-width: 600px) {
  .cc-modal__footer {
    flex-direction: row;
    justify-content: flex-end;
    padding: 14px 24px 18px;
  }
}

/* Botones del modal: ancho completo en móvil */
.cc-modal__footer .cc-btn {
  width: 100%;
}

@media (min-width: 600px) {
  .cc-modal__footer .cc-btn {
    width: auto;
  }
  /* En desktop: primero el ghost, luego primary */
  .cc-modal__footer .cc-btn--ghost   { order: 1; }
  .cc-modal__footer .cc-btn--primary { order: 2; }
}

/* =========================================================
   CATEGORÍAS DE COOKIES
   ========================================================= */
.cc-category {
  padding: 14px 0;
  border-bottom: 1px solid var(--cc-border);
}
.cc-category:last-child { border-bottom: none; }

.cc-category__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cc-category__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--cc-text);
  display: block;
  margin-bottom: 4px;
}

.cc-category__desc {
  font-size: 13px;
  color: var(--cc-text-muted);
  line-height: 1.55;
}

/* =========================================================
   TOGGLE SWITCH
   ========================================================= */
.cc-toggle {
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  /* Área táctil mínima */
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.cc-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cc-toggle__track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--cc-toggle-off);
  border-radius: 12px;
  transition: background var(--cc-duration);
}

.cc-toggle input:checked + .cc-toggle__track {
  background: var(--cc-toggle-on);
}

.cc-toggle input:focus-visible + .cc-toggle__track {
  outline: 2px solid var(--cc-primary);
  outline-offset: 2px;
}

.cc-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--cc-duration) cubic-bezier(.34,1.3,.64,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.cc-toggle input:checked + .cc-toggle__track .cc-toggle__thumb {
  transform: translateX(20px);
}

/* ── "Siempre activas" badge ────────────────────────────── */
.cc-always {
  font-size: 12px;
  font-weight: 500;
  color: var(--cc-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  /* Alinear con el toggle */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

@media (min-width: 600px) {
  .cc-always {
    min-width: auto;
    min-height: auto;
    display: inline;
    margin-top: 4px;
  }
}
