/* ============================================================
   XESTIO — cookie_banner.css
   Banner de consentimiento + modal de preferencias.
   Usa tokens de tokens.css.
   ============================================================ */

#cookie-banner[hidden],
#cookie-modal[hidden] { display: none !important; }

/* ---------- BANNER ---------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  background: #0E4D57;
  color: #ffffff;
  box-shadow: 0 -6px 24px rgba(12, 18, 26, 0.28);
  font-family: var(--font-sans, "Poppins", system-ui, sans-serif);
  animation: cookie-slide-up .35s ease-out;
}

@keyframes cookie-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.cookie-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.cookie-banner__text {
  flex: 1 1 360px;
  font-size: .95rem;
  line-height: 1.5;
}

.cookie-banner__title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .25rem;
}

.cookie-banner__text a {
  color: #E0A800;
  font-weight: 600;
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

/* ---------- BOTONES ---------- */
.cookie-btn {
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  border-radius: 8px;
  padding: .6rem 1.1rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
  line-height: 1;
}
.cookie-btn:active { transform: translateY(1px); }
.cookie-btn:focus-visible { outline: 2px solid #E0A800; outline-offset: 2px; }

.cookie-btn--primary {
  background: #E0A800;
  color: #1e2d35;
  border-color: #E0A800;
}
.cookie-btn--primary:hover { background: #C58F00; border-color: #C58F00; }

.cookie-btn--ghost {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
}
.cookie-btn--ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: #ffffff; }

.cookie-btn--link {
  background: transparent;
  color: #ffffff;
  border-color: transparent;
  text-decoration: underline;
  padding-left: .5rem;
  padding-right: .5rem;
}
.cookie-btn--link:hover { color: #E0A800; }

/* ---------- MODAL ---------- */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans, "Poppins", system-ui, sans-serif);
}

.cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 26, 0.6);
  backdrop-filter: blur(2px);
}

.cookie-modal__dialog {
  position: relative;
  background: #ffffff;
  color: #1e2d35;
  width: min(560px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(12, 18, 26, 0.3);
  padding: 1.75rem 1.75rem 1.5rem;
  animation: cookie-modal-pop .25s ease-out;
}

@keyframes cookie-modal-pop {
  from { transform: scale(.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.cookie-modal__close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #5a6e7a;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}
.cookie-modal__close:hover { background: #EDF2F7; color: #1e2d35; }

.cookie-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0E4D57;
  margin: 0 0 .5rem;
}

.cookie-modal__intro {
  font-size: .92rem;
  color: #5a6e7a;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

/* ---------- CATEGORÍAS ---------- */
.cookie-category {
  border: 1px solid #EDF2F7;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: .9rem;
  background: #f9fafb;
}
.cookie-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cookie-category__name {
  font-weight: 700;
  color: #0E4D57;
  font-size: .98rem;
}
.cookie-category__desc {
  font-size: .85rem;
  color: #5a6e7a;
  margin: .35rem 0 0;
  line-height: 1.45;
}
.cookie-category__locked {
  font-size: .75rem;
  font-weight: 700;
  color: #0f7a66;
  background: rgba(15, 122, 102, 0.1);
  padding: .25rem .6rem;
  border-radius: 999px;
  letter-spacing: .02em;
}

/* ---------- TOGGLE ---------- */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.cookie-toggle__slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease;
}
.cookie-toggle__slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.cookie-toggle input:checked + .cookie-toggle__slider { background: #0f7a66; }
.cookie-toggle input:checked + .cookie-toggle__slider::before { transform: translateX(20px); }
.cookie-toggle input:focus-visible + .cookie-toggle__slider { outline: 2px solid #E0A800; outline-offset: 2px; }

/* ---------- FOOTER MODAL ---------- */
.cookie-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}
.cookie-modal__actions .cookie-btn--ghost { color: #0E4D57; border-color: #cbd5e1; }
.cookie-modal__actions .cookie-btn--ghost:hover { background: #EDF2F7; border-color: #0E4D57; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .cookie-banner__inner { padding: 1rem 1.1rem; }
  .cookie-banner__text { flex: 1 1 100%; font-size: .9rem; }
  .cookie-banner__actions { width: 100%; justify-content: stretch; }
  .cookie-banner__actions .cookie-btn { flex: 1 1 auto; text-align: center; }
  .cookie-modal__dialog { padding: 1.25rem; }
}
