/* ==========================================================================
   Cookie consent — banner, preferences modal, floating manage button
   ========================================================================== */

.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  padding: 1.25rem 1.5rem;
  background: hsl(var(--white));
  border-top: 1px solid hsl(var(--gray-200));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  animation: cookie-slide-up 0.35s ease;
}

@keyframes cookie-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-banner-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.cookie-banner-text {
  flex: 1 1 280px;
  min-width: 0;
}

.cookie-banner-text h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--primary));
}

.cookie-banner-text p {
  font-size: 0.9rem;
  color: hsl(var(--gray-600));
  margin: 0;
  line-height: 1.5;
}

.cookie-banner-text a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
}

.cookie-btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--border-radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.cookie-btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--white));
  border-color: hsl(var(--primary));
}

.cookie-btn-primary:hover {
  background: hsl(var(--accent-3));
  border-color: hsl(var(--accent-3));
}

.cookie-btn-secondary {
  background: transparent;
  color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.cookie-btn-secondary:hover {
  background: hsl(var(--gray-50));
}

.cookie-btn-ghost {
  background: hsl(var(--gray-100));
  color: hsl(var(--gray-700));
  border-color: hsl(var(--gray-200));
}

.cookie-btn-ghost:hover {
  background: hsl(var(--gray-200));
}

/* Floating cookie settings button */
.cookie-settings-fab {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 10040;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  background: hsl(var(--primary));
  color: hsl(var(--white));
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(20, 107, 174, 0.35);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cookie-settings-fab:hover {
  transform: scale(1.06);
  background: hsl(var(--accent-3));
}

.cookie-settings-fab:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 3px;
}

/* Preferences modal */
.cookie-preferences-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cookie-preferences-modal[hidden] {
  display: none !important;
}

.cookie-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.cookie-modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: hsl(var(--white));
  border-radius: calc(var(--border-radius) * 2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  padding: 1.75rem;
}

.cookie-modal-panel h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  padding-right: 2rem;
}

.cookie-modal-panel > p {
  font-size: 0.9rem;
  color: hsl(var(--gray-600));
  margin-bottom: 1.5rem;
}

.cookie-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: hsl(var(--gray-100));
  color: hsl(var(--gray-700));
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.cookie-modal-close:hover {
  background: hsl(var(--gray-200));
}

.cookie-category {
  border: 1px solid hsl(var(--gray-200));
  border-radius: var(--border-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.cookie-category-header h3 {
  font-size: 1rem;
  margin: 0;
  font-family: inherit;
  color: hsl(var(--gray-900));
}

.cookie-category p {
  font-size: 0.8125rem;
  color: hsl(var(--gray-500));
  margin: 0;
  line-height: 1.45;
}

.cookie-category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--gray-500));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cookie-toggle-slider {
  position: absolute;
  inset: 0;
  background: hsl(var(--gray-300));
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: hsl(var(--white));
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: hsl(var(--primary));
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(20px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
  opacity: 0.65;
  cursor: not-allowed;
}

.cookie-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--gray-200));
}

body.cookie-modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .cookie-consent-banner {
    padding: 1rem;
  }

  .cookie-banner-actions {
    width: 100%;
  }

  .cookie-banner-actions .cookie-btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .cookie-settings-fab {
    bottom: 1rem;
    left: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.2rem;
  }

  body:has(.cookie-consent-banner:not([hidden])) .cookie-settings-fab {
    bottom: 7.5rem;
  }
}
