/* ============================================================
   DCP — SISTEMA DE CONSENTIMIENTO DE COOKIES (SCC) v1.0
   Deschull Pharma
============================================================ */

.cookie-modal-open {
  overflow: hidden;
}

/* -------------------------------
   Banner
-------------------------------- */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1400;
  width: min(calc(100% - 32px), 1040px);
  transform: translateX(-50%);
  padding: 10px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(91, 204, 221, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(17, 17, 17, 0.075);
  box-shadow: 0 26px 80px rgba(17, 17, 17, 0.18);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: cookieBannerIn 0.38s ease forwards;
}

.cookie-banner.is-hidden {
  pointer-events: none;
  animation: cookieBannerOut 0.26s ease forwards;
}

.cookie-banner__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 20px 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
}

.cookie-banner__text {
  max-width: 680px;
}

.cookie-banner__label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  font-family: var(--font-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.cookie-banner__text p {
  margin: 0;
  color: rgba(17, 17, 17, 0.68);
  font-size: 0.96rem;
  line-height: 1.7;
}

.cookie-banner__text a {
  display: inline-flex;
  margin-top: 8px;
  font-family: var(--font-accent);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.82;
  transition: opacity 0.22s ease, color 0.22s ease;
}

.cookie-banner__text a:hover {
  color: var(--color-accent);
  opacity: 1;
}

.cookie-banner__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.cookie-banner__actions .btn {
  min-height: 46px;
  padding-inline: 20px;
  font-size: 0.88rem;
  white-space: nowrap;
}

.cookie-banner__actions .btn-secondary {
  background: rgba(255, 255, 255, 0.66);
}

/* -------------------------------
   Modal
-------------------------------- */

.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease;
}

.cookie-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.cookie-modal__panel {
  position: relative;
  width: min(100%, 720px);
  max-height: min(88vh, 860px);
  overflow: auto;
  padding: 34px;
  border-radius: 34px;
  background:
    radial-gradient(circle at top right, rgba(91, 204, 221, 0.14), transparent 32%),
    rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 34px 100px rgba(17, 17, 17, 0.24);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.3s ease;
}

.cookie-modal.is-open .cookie-modal__panel {
  transform: translateY(0) scale(1);
}

.cookie-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.055);
  color: var(--color-text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.22s ease, transform 0.22s ease;
}

.cookie-modal__close:hover {
  background: rgba(17, 17, 17, 0.095);
  transform: rotate(4deg) scale(1.03);
}

.cookie-modal__header {
  max-width: 600px;
  padding-right: 54px;
  margin-bottom: 28px;
}

.cookie-modal__header h2 {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.cookie-modal__header p {
  margin: 0;
  color: var(--color-text-soft);
  font-size: 0.98rem;
  line-height: 1.75;
}

.cookie-preferences-form {
  display: grid;
  gap: 14px;
}

/* -------------------------------
   Opciones
-------------------------------- */

.cookie-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 112px;
  padding: 22px 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(17, 17, 17, 0.065);
  box-shadow: 0 12px 34px rgba(17, 17, 17, 0.04);
  cursor: pointer;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease,
    background-color 0.24s ease;
}

.cookie-option:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 17, 17, 0.1);
  box-shadow: 0 18px 44px rgba(17, 17, 17, 0.075);
}

.cookie-option--locked {
  cursor: default;
  background:
    radial-gradient(circle at top right, rgba(91, 204, 221, 0.12), transparent 30%),
    rgba(255, 255, 255, 0.82);
}

.cookie-option--locked:hover {
  transform: none;
  box-shadow: 0 12px 34px rgba(17, 17, 17, 0.04);
}

.cookie-option h3 {
  margin: 0 0 5px;
  font-size: 1.18rem;
  letter-spacing: -0.035em;
}

.cookie-option p {
  max-width: 520px;
  margin: 0;
  color: rgba(17, 17, 17, 0.58);
  font-size: 0.92rem;
  line-height: 1.65;
}

.cookie-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cookie-option__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(91, 204, 221, 0.14);
  color: var(--color-text);
  font-family: var(--font-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* -------------------------------
   Switches
-------------------------------- */

.cookie-switch {
  position: relative;
  display: inline-flex;
  width: 58px;
  height: 34px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.14);
  box-shadow: inset 0 1px 3px rgba(17, 17, 17, 0.12);
  transition: background-color 0.24s ease, box-shadow 0.24s ease;
}

.cookie-switch::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.22);
  transition: transform 0.24s ease;
}

.cookie-option input:checked + .cookie-switch {
  background: var(--color-accent);
  box-shadow: inset 0 1px 3px rgba(17, 17, 17, 0.08), 0 0 0 4px rgba(91, 204, 221, 0.12);
}

.cookie-option input:checked + .cookie-switch::before {
  transform: translateX(24px);
}

.cookie-option:focus-within {
  outline: 3px solid rgba(91, 204, 221, 0.34);
  outline-offset: 4px;
}

/* -------------------------------
   Acciones del modal
-------------------------------- */

.cookie-modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(17, 17, 17, 0.08);
}

.cookie-modal__actions .btn {
  min-height: 52px;
  padding-inline: 24px;
}

/* -------------------------------
   Enlace de footer / botón externo
-------------------------------- */

.cookie-preferences-link,
[data-open-cookie-preferences] {
  cursor: pointer;
}

/* -------------------------------
   Animaciones
-------------------------------- */

@keyframes cookieBannerIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes cookieBannerOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.985);
  }
}

/* -------------------------------
   Responsive
-------------------------------- */

@media (max-width: 900px) {
  .cookie-banner {
    bottom: 16px;
    width: min(calc(100% - 24px), 720px);
    border-radius: 26px;
  }

  .cookie-banner__content {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
    border-radius: 22px;
  }

  .cookie-banner__actions {
    justify-content: flex-start;
  }

  .cookie-modal {
    padding: 16px;
  }

  .cookie-modal__panel {
    padding: 28px 22px;
    border-radius: 28px;
  }

  .cookie-modal__header {
    padding-right: 42px;
  }

  .cookie-option {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 20px;
    border-radius: 22px;
  }
}

@media (max-width: 640px) {
  .cookie-banner {
    bottom: 12px;
    width: calc(100% - 20px);
    padding: 8px;
    border-radius: 24px;
  }

  .cookie-banner__content {
    padding: 18px 16px;
  }

  .cookie-banner__actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .cookie-banner__actions .btn {
    width: 100%;
  }

  .cookie-modal__panel {
    max-height: 90vh;
    padding: 26px 18px;
  }

  .cookie-modal__close {
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
  }

  .cookie-modal__header {
    padding-right: 34px;
  }

  .cookie-option,
  .cookie-option--locked {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .cookie-option__status,
  .cookie-switch {
    justify-self: start;
  }

  .cookie-modal__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cookie-modal__actions .btn {
    width: 100%;
  }
}

/* -------------------------------
   Accesibilidad: reduce motion
-------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-banner.is-hidden,
  .cookie-modal,
  .cookie-modal__panel,
  .cookie-option,
  .cookie-switch,
  .cookie-switch::before,
  .cookie-modal__close {
    animation: none !important;
    transition: none !important;
  }
}
