/* Conexia — Cookie consent banner + modal
   Vanilla CSS, design system v3 (Emil Kowalski).
   Carga con cx-cookies.js. */

/* ════════════ BANNER (bottom-left flotante) ════════════ */
.cx-cc-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 9100;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--cx-r-lg, 18px);
  box-shadow: 0 24px 60px -16px rgba(15, 23, 42, 0.28), 0 4px 12px -4px rgba(15, 23, 42, 0.10);
  overflow: hidden;
  font-family: var(--cx-font);
  color: var(--cx-ink);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 280ms ease;
}
.cx-cc-banner.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 640px) {
  .cx-cc-banner { right: auto; max-width: 400px; bottom: 24px; left: 24px; }
}

.cx-cc-banner__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 8px;
}
.cx-cc-banner__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(47, 107, 255, 0.10);
  color: var(--cx-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cx-cc-banner__icon svg { width: 20px; height: 20px; }
.cx-cc-banner__title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cx-ink);
}

.cx-cc-banner__body {
  padding: 0 22px 14px;
}
.cx-cc-banner__text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cx-mute);
}
.cx-cc-banner__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cx-blue);
  text-decoration: none;
  transition: color 150ms ease;
}
.cx-cc-banner__link:hover { color: var(--cx-blue-dark); }
.cx-cc-banner__link svg {
  width: 12px; height: 12px;
  transition: transform 150ms ease;
}
.cx-cc-banner__link:hover svg { transform: translateX(2px); }

.cx-cc-banner__actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--cx-line-soft);
  background: rgba(247, 249, 255, 0.6);
}
@media (max-width: 480px) {
  .cx-cc-banner__actions { grid-template-columns: 1fr; }
}

.cx-cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cx-ink);
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms ease;
  white-space: nowrap;
}
.cx-cc-btn--primary {
  background: var(--cx-ink);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}
.cx-cc-btn--primary:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.25);
}
.cx-cc-btn--secondary {
  background: #fff;
  border-color: var(--cx-line);
  color: var(--cx-ink);
}
.cx-cc-btn--secondary:hover {
  border-color: #c8cde0;
  background: var(--cx-bg-soft);
}
.cx-cc-btn--ghost {
  background: transparent;
  color: var(--cx-mute);
}
.cx-cc-btn--ghost:hover {
  background: var(--cx-bg-mute);
  color: var(--cx-ink);
}
.cx-cc-btn:focus-visible {
  outline: 2px solid var(--cx-blue);
  outline-offset: 2px;
}

/* ════════════ MODAL (Personalizar) ════════════ */
.cx-cc-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(8, 12, 28, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.cx-cc-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cx-cc-modal {
  position: relative;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--cx-r-lg, 18px);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.05);
  transform: scale(0.94) translateY(8px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 220ms ease;
  font-family: var(--cx-font);
  color: var(--cx-ink);
}
.cx-cc-modal-backdrop.is-open .cx-cc-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.cx-cc-modal__head {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--cx-line-soft);
}
.cx-cc-modal__title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.cx-cc-modal__desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--cx-mute);
  line-height: 1.5;
}
.cx-cc-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--cx-line);
  background: #fff;
  color: var(--cx-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
}
.cx-cc-modal__close:hover {
  background: var(--cx-blue);
  color: #fff;
  border-color: var(--cx-blue);
  transform: rotate(90deg);
}
.cx-cc-modal__close svg { width: 14px; height: 14px; }

.cx-cc-modal__body {
  padding: 18px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Card por categoría */
.cx-cc-card {
  padding: 14px 16px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  background: #fff;
  transition: all 200ms ease;
}
.cx-cc-card.is-on {
  border-color: rgba(47, 107, 255, 0.30);
  background: rgba(47, 107, 255, 0.04);
}
.cx-cc-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cx-cc-card__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.cx-cc-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--cx-bg-mute);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cx-ink-soft);
  flex-shrink: 0;
  transition: background 200ms ease, color 200ms ease;
}
.cx-cc-card.is-on .cx-cc-card__icon {
  background: rgba(47, 107, 255, 0.12);
  color: var(--cx-blue);
}
.cx-cc-card__icon svg { width: 16px; height: 16px; }
.cx-cc-card__name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--cx-ink);
  letter-spacing: -0.005em;
}
.cx-cc-card__badge {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(47, 107, 255, 0.10);
  color: var(--cx-blue);
}
.cx-cc-card__desc {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--cx-mute);
}

/* Toggle switch */
.cx-cc-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.cx-cc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.cx-cc-switch__track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: background 200ms ease;
}
.cx-cc-switch__track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.20);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cx-cc-switch input:checked + .cx-cc-switch__track {
  background: var(--cx-blue);
}
.cx-cc-switch input:checked + .cx-cc-switch__track::before {
  transform: translateX(16px);
}
.cx-cc-switch input:disabled + .cx-cc-switch__track {
  opacity: 0.55;
  cursor: not-allowed;
}
.cx-cc-switch input:focus-visible + .cx-cc-switch__track {
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.30);
}

.cx-cc-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid var(--cx-line-soft);
  background: rgba(247, 249, 255, 0.6);
}
@media (max-width: 480px) {
  .cx-cc-modal__foot {
    flex-direction: column-reverse;
  }
  .cx-cc-modal__foot .cx-cc-btn {
    width: 100%;
  }
}

/* Reduced motion: skip animations */
@media (prefers-reduced-motion: reduce) {
  .cx-cc-banner,
  .cx-cc-modal,
  .cx-cc-modal-backdrop {
    transition: opacity 100ms ease;
  }
  .cx-cc-banner.is-open,
  .cx-cc-modal-backdrop.is-open .cx-cc-modal {
    transform: none;
  }
}
