/*
 * IBGMx Ecosystem — Gestor estándar de consentimiento
 * Componente visual reutilizable. La marca puede sobrescribir las variables
 * --consent-* sin alterar la estructura ni la lógica funcional.
 */
:root {
  --consent-accent: #123f4a;
  --consent-accent-strong: #0d3340;
  --consent-surface: #ffffff;
  --consent-text: #141a20;
  --consent-muted: #5f6870;
  --consent-line: #dce2e5;
  --consent-overlay: rgba(5, 12, 17, .62);
  --consent-radius: 14px;
  --consent-shadow: 0 24px 80px rgba(5, 12, 17, .28);
}

html.cookie-consent-open,
html.cookie-consent-open body { overflow: hidden; }

.cookie-consent {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 3vw, 32px);
  background: var(--consent-overlay);
  backdrop-filter: blur(2px);
}

html.cookie-consent-pending .cookie-consent,
.cookie-consent.is-open { display: flex; }

.cookie-consent__panel {
  width: min(790px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--consent-surface);
  color: var(--consent-text);
  border: 1px solid rgba(18, 63, 74, .14);
  border-radius: var(--consent-radius);
  box-shadow: var(--consent-shadow);
}

.cookie-consent__summary {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: clamp(22px, 4vw, 32px);
  border-bottom: 1px solid var(--consent-line);
}

.cookie-consent__hero-icon,
.cookie-category__icon {
  display: grid;
  place-items: center;
  color: var(--consent-accent);
}

.cookie-consent__hero-icon {
  width: 46px;
  height: 46px;
}

.cookie-consent__hero-icon svg { width: 38px; height: 38px; }

.cookie-consent__eyebrow {
  margin: 0 0 6px;
  color: var(--consent-accent);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.cookie-consent__summary h2 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.cookie-consent__summary-copy > p:last-child {
  max-width: 650px;
  margin: 0;
  line-height: 1.55;
}

.cookie-consent__close {
  appearance: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--consent-accent);
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.cookie-consent__close:hover,
.cookie-consent__close:focus-visible { background: rgba(18, 63, 74, .08); }

.cookie-consent__settings {
  padding: 0 clamp(22px, 4vw, 32px);
}

.cookie-consent__settings[hidden],
.cookie-btn[hidden],
.cookie-consent__close[hidden] { display: none !important; }

.cookie-category {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--consent-line);
}

.cookie-category:last-child { border-bottom: 0; }

.cookie-category__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(18, 63, 74, .08);
}

.cookie-category__icon svg { width: 23px; height: 23px; }

.cookie-category__copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1rem;
}

.cookie-category__copy small {
  display: block;
  color: var(--consent-muted);
  line-height: 1.4;
}

.cookie-category__more {
  display: inline-block;
  margin-top: 4px;
  color: var(--consent-accent);
  font-size: .84rem;
  text-underline-offset: 2px;
}

.cookie-category__status {
  color: #17733b;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.cookie-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

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

.cookie-switch__track {
  position: relative;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #c7cdd2;
  transition: background .18s ease;
}

.cookie-switch__track::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.24);
  transition: transform .18s ease;
}

.cookie-switch input:checked + .cookie-switch__track { background: var(--consent-accent); }
.cookie-switch input:checked + .cookie-switch__track::after { transform: translateX(22px); }
.cookie-switch input:focus-visible + .cookie-switch__track { outline: 3px solid rgba(18, 63, 74, .25); outline-offset: 3px; }

.cookie-consent__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 20px clamp(22px, 4vw, 32px) 24px;
  border-top: 1px solid var(--consent-line);
}

.cookie-btn {
  appearance: none;
  min-height: 44px;
  border: 1px solid var(--consent-accent);
  border-radius: 6px;
  background: #fff;
  color: var(--consent-accent);
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.cookie-btn:hover,
.cookie-btn:focus-visible { background: rgba(18, 63, 74, .06); }
.cookie-btn--primary { background: var(--consent-accent); color: #fff; }
.cookie-btn--primary:hover,
.cookie-btn--primary:focus-visible { background: var(--consent-accent-strong); }

.cookie-preferences-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-size: .83rem;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.38);
  text-underline-offset: 3px;
  cursor: pointer;
  opacity: .78;
}
.cookie-preferences-link:hover,
.cookie-preferences-link:focus-visible { opacity: 1; }

@media (max-width: 720px) {
  .cookie-consent { align-items: flex-end; padding: 0; }
  .cookie-consent__panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
  .cookie-consent__summary { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; padding: 20px; }
  .cookie-consent__hero-icon { width: 38px; height: 38px; }
  .cookie-consent__hero-icon svg { width: 31px; height: 31px; }
  .cookie-consent__settings { padding: 0 20px; }
  .cookie-category { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 16px 0; }
  .cookie-category__icon { width: 40px; height: 40px; border-radius: 10px; }
  .cookie-category__status { font-size: .74rem; }
  .cookie-consent__actions { display: grid; grid-template-columns: 1fr; padding: 16px 20px 20px; }
  .cookie-btn { width: 100%; }
}

@media (max-width: 430px) {
  .cookie-consent__hero-icon { display: none; }
  .cookie-consent__summary { grid-template-columns: minmax(0, 1fr) auto; }
  .cookie-category { grid-template-columns: minmax(0, 1fr) auto; }
  .cookie-category__icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-switch__track,
  .cookie-switch__track::after { transition: none; }
}

/* V0.42-RC6 — Enlace de preferencias en footer: discreto, legible y accesible */
.cookie-preferences-link,
[data-cookie-preferences] {
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: color 160ms ease, text-decoration-color 160ms ease;
}

.cookie-preferences-link:hover,
[data-cookie-preferences]:hover {
    color: #ffffff;
    text-decoration-color: currentColor;
}

.cookie-preferences-link:focus,
[data-cookie-preferences]:focus {
    outline: none;
}

.cookie-preferences-link:focus-visible,
[data-cookie-preferences]:focus-visible {
    color: #ffffff;
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 4px;
}
