/* ==========================================================================
   NEXT Cookie Compliance — Banner & Modal styles
   Paleta de marca Next Assurance:
     #006EC6  azul primario (logo)   ·  #7CBB00  verde acento
     #5B5751  gris cálido (texto)    ·  #F5F7FA  fondo claro
   Tipografía: Inter
   ========================================================================== */

:root {
  --ncc-primary: #006EC6;          /* azul de marca (overridable inline) */
  --ncc-primary-hover: #005CA3;    /* hover del CTA primario            */
  --ncc-accent: #7CBB00;           /* verde de marca (estados activos)  */
  --ncc-dark: #2A2724;             /* barra: negro cálido on-brand      */
  --ncc-dark-2: #1B1917;           /* variante tema oscuro              */
  --ncc-ink: #5B5751;              /* gris cálido para texto            */
  --ncc-gray-mid: #6B6B6B;
  --ncc-gray-light: #F5F7FA;
  --ncc-white: #FFFFFF;
  --ncc-radius: 10px;
  --ncc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#ncc-banner,
#ncc-modal {
  font-family: var(--ncc-font);
  box-sizing: border-box;
}

#ncc-banner *,
#ncc-modal * {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------- */
/* Banner principal (barra inferior fija)                                 */
/* ---------------------------------------------------------------------- */

.ncc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  background: var(--ncc-dark);
  color: var(--ncc-white);
  padding: 14px 20px;
  /* Respeta el área segura inferior de iOS (home indicator) para que el
     botón "Aceptar" nunca quede bajo la zona de gestos del sistema. */
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  /* Red de seguridad: en pantallas muy bajas (móvil en horizontal) el
     banner nunca supera la altura visible y su contenido es desplazable,
     evitando que los botones queden fuera de pantalla. */
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Blindaje: si el banner lleva el atributo [hidden], permanece oculto
   pase lo que pase, aunque el tema active fuertemente `display` en divs. */
.ncc-banner[hidden] {
  display: none !important;
}

.ncc-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.ncc-banner__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.ncc-banner__brand {
  flex: 0 0 auto;
}

.ncc-banner__logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--ncc-white);
  letter-spacing: -0.02em;
}

.ncc-banner__text {
  flex: 1 1 320px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #E4E2DF;
  margin: 0;
}

.ncc-banner__link {
  color: var(--ncc-white);
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.ncc-banner__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ncc-banner__close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #B5B5B5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  z-index: 1;
}

.ncc-banner__close:hover {
  color: var(--ncc-white);
}

/* Modo oscuro (Next Assurance dark) */
.ncc-theme-dark.ncc-banner {
  background: var(--ncc-dark-2);
}

/* ---------------------------------------------------------------------- */
/* Botones                                                                 */
/* ---------------------------------------------------------------------- */

.ncc-btn {
  font-family: var(--ncc-font);
  font-size: 12.5px;
  font-weight: 600;
  min-height: 44px;                /* objetivo táctil accesible (WCAG)   */
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}

.ncc-btn--ghost {
  background: #3A3733;
  color: var(--ncc-white);
  border-color: #4A4641;
}

.ncc-btn--ghost:hover {
  background: #46423D;
}

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

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

.ncc-btn:active {
  transform: translateY(1px);
}

.ncc-btn:focus-visible {
  outline: 2px solid var(--ncc-white);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------- */
/* Modal de preferencias                                                  */
/* ---------------------------------------------------------------------- */

.ncc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ncc-modal[hidden] {
  display: none;
}

.ncc-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(3px);
}

.ncc-modal__panel {
  position: relative;
  background: var(--ncc-white);
  color: var(--ncc-ink);
  width: min(480px, 92vw);
  max-height: 86dvh;
  overflow-y: auto;
  border-radius: var(--ncc-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 0;
  animation: ncc-modal-in 0.25s ease;
}

@keyframes ncc-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ncc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ncc-gray-light);
}

.ncc-modal__header h2 {
  font-size: 16px;
  margin: 0;
  color: var(--ncc-dark);
}

.ncc-modal__close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ncc-gray-mid);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

.ncc-modal__body {
  padding: 8px 20px;
}

.ncc-category {
  padding: 14px 0;
  border-bottom: 1px solid var(--ncc-gray-light);
}

.ncc-category:last-child {
  border-bottom: none;
}

.ncc-category__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ncc-category__label {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ncc-dark);
}

.ncc-category__badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #4E7A00;
  background: rgba(124, 187, 0, 0.14);
  border: 1px solid rgba(124, 187, 0, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ncc-category__desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ncc-gray-mid);
  line-height: 1.4;
}

.ncc-modal__footer {
  padding: 16px 20px 20px;
}

.ncc-modal__footer .ncc-btn {
  width: 100%;
}

/* Toggle switch */
.ncc-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
}

.ncc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ncc-switch__slider {
  position: absolute;
  inset: 0;
  background: #CBD2D9;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ncc-switch__slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: var(--ncc-white);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.ncc-switch input:checked + .ncc-switch__slider {
  background: var(--ncc-primary);
}

.ncc-switch input:checked + .ncc-switch__slider::before {
  transform: translateX(18px);
}

/* Categoría necesaria (siempre activa): verde de marca. */
.ncc-switch input:disabled + .ncc-switch__slider {
  background: var(--ncc-accent);
  opacity: 0.85;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------- */
/* Accesibilidad y responsive                                             */
/* ---------------------------------------------------------------------- */

.ncc-btn:focus-visible,
.ncc-switch input:focus-visible + .ncc-switch__slider {
  outline: 2px solid var(--ncc-primary);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .ncc-banner {
    padding: 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .ncc-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    /* Deja espacio para el botón de cerrar (esquina superior derecha). */
    padding-top: 6px;
  }

  .ncc-banner__brand {
    padding-right: 36px;
  }

  /* Botones a lo ancho y en columna: cada uno es un objetivo táctil
     grande y separado. El botón "Aceptar" va arriba (más prominente y
     de fácil alcance con el pulgar). */
  .ncc-banner__actions {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .ncc-banner__actions .ncc-btn {
    width: 100%;
    min-height: 48px;
    font-size: 14px;
  }

  #ncc-btn-accept  { order: 1; }
  #ncc-btn-reject  { order: 2; }
  #ncc-btn-settings { order: 3; }

  .ncc-banner__close {
    top: 6px;
    right: 8px;
    font-size: 26px;
    padding: 8px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ncc-banner,
  .ncc-modal__panel {
    transition: none;
    animation: none;
  }
}
