/* Cookie consent banner (src/components/CookieConsent.tsx). Linked after mobile.css.
   Transform and opacity only for motion. Buttons are at least 44px tall with 16px text. */

.cc {
  position: fixed;
  left: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60; /* above the WhatsApp float (z-index 50) */
  box-sizing: border-box;
  width: min(440px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(18, 20, 58, 0.1);
  border-radius: 16px;
  background: #fff;
  color: #12143a;
  font-family: var(--font-text, system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(18, 20, 58, 0.05), 0 18px 40px -20px rgba(11, 13, 36, 0.5);
  animation: cc-in 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cc__title {
  margin: 0 0 8px;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #14163a;
}

.cc__body,
.cc__meta {
  margin: 0;
  color: #565a7a;
}

.cc__meta {
  margin-top: 8px;
  font-size: 16px;
}

.cc a {
  color: #2f3190;
  font-weight: 600;
  text-underline-offset: 3px;
}

.cc a:focus-visible,
.cc button:focus-visible,
.cc input:focus-visible {
  outline: 3px solid #2f3190;
  outline-offset: 3px;
}

.cc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.cc__btn {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid #14163a;
  border-radius: 999px;
  font: 600 16px/1 var(--font-text, system-ui, sans-serif);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), background-color 160ms linear, color 160ms linear;
}

.cc__btn--solid {
  background: #14163a;
  color: #fff;
}

.cc__btn--solid:hover {
  background: #2f3190;
  border-color: #2f3190;
}

.cc__btn--outline {
  background: #fff;
  color: #14163a;
  border-color: rgba(18, 20, 58, 0.35);
}

.cc__btn--outline:hover {
  border-color: #14163a;
}

.cc__btn:active {
  transform: scale(0.975);
}

/* customise panel */
.cc__panel {
  margin: 16px 0 0;
}

.cc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(18, 20, 58, 0.1);
}

.cc-toggle__text {
  display: block;
  cursor: pointer;
}

.cc-toggle__name {
  display: block;
  font-weight: 600;
  color: #12143a;
}

.cc-toggle__hint {
  display: block;
  color: #565a7a;
}

.cc-switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
}

.cc-switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cc-switch__input:disabled {
  cursor: not-allowed;
}

.cc-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9cce0;
  transition: background-color 200ms linear;
  pointer-events: none;
}

.cc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(18, 20, 58, 0.25);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cc-switch__input:checked + .cc-switch__track {
  background: #14163a;
}

.cc-switch__input:checked + .cc-switch__track::after {
  transform: translateX(20px);
}

.cc-switch__input:disabled + .cc-switch__track {
  opacity: 0.6;
}

.cc-switch__input:focus-visible + .cc-switch__track {
  outline: 3px solid #2f3190;
  outline-offset: 3px;
}

/* footer link that reopens the banner */
.cc-settings-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cc-settings-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* mobile: full-width sheet at the bottom, safe-area aware, WhatsApp float hidden while open */
@media (max-width: 640px) {
  .cc {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 85dvh;
    padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    border-radius: 16px 16px 0 0;
    border-width: 1px 0 0;
    box-shadow: 0 -10px 30px -12px rgba(11, 13, 36, 0.35);
  }

  .cc__actions {
    flex-direction: column;
  }

  .cc__btn {
    flex: none;
    width: 100%;
  }

  body.has-consent .wa-float {
    display: none;
  }
}

@keyframes cc-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc {
    animation: none;
  }

  .cc__btn,
  .cc-switch__track,
  .cc-switch__track::after {
    transition: none;
  }

  .cc__btn:active {
    transform: none;
  }
}
