/* Cookie Banner Styles — granular 3-category consent */

/* ---- Main banner ---- */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(107deg, #0f3443 0%, #34e89e 100%);
  color: white;
  padding: 24px 20px;
  box-shadow: 0 -4px 24px rgba(15, 52, 67, 0.2);
  z-index: 10000;
  display: none;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-banner.visible {
  display: block;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-banner-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cookie-banner-content {
  flex: 1;
  min-width: 300px;
}

.cookie-banner-content p {
  margin: 0;
  font-size: 0.95em;
  line-height: 1.5;
  opacity: 0.95;
}

.cookie-banner-content a {
  color: white;
  text-decoration: underline;
  font-weight: 600;
}

.cookie-banner-content a:hover {
  opacity: 0.8;
}

.cookie-banner-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cookie-banner-button {
  padding: 12px 28px;
  border-radius: 24px;
  font-weight: 650;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: inherit;
  border: 2px solid transparent;
}

.cookie-banner-button:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

.cookie-banner-button-accept {
  background: white;
  color: #0f3443;
  border-color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cookie-banner-button-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.cookie-banner-button-essential {
  background: transparent;
  color: white;
  border-color: white;
}

.cookie-banner-button-essential:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* EROD 03/2022 (https://www.edpb.europa.eu/our-work-tools/our-documents/guidelines/guidelines-032022-deceptive-design-patterns-social-media_en):
   visual equality — Customize button matches Accept All in size/padding/font.
   font-size and padding inherited from .cookie-banner-button (0.95em / 12px 28px / border 2px).
   Only color/border differ visually, not weight/size. */
.cookie-banner-button-customize {
  background: transparent;
  color: white;
  border-color: white;
}

.cookie-banner-button-customize:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

#cookie-settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(15, 52, 67, 0.7);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#cookie-settings-modal[aria-hidden="false"] {
  display: flex;
}

.cookie-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15, 52, 67, 0.25);
  position: relative;
}

.cookie-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.cookie-modal-header h2 {
  color: #0f3443;
  font-size: 1.35em;
  font-weight: 700;
  margin: 0;
}

.cookie-modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 1.5em;
  line-height: 1;
  /* WCAG 2.5.5 Target Size — minimum 44×44 CSS px */
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.cookie-modal-close-btn:hover {
  color: #0f3443;
}

.cookie-modal-close-btn:focus {
  outline: 2px solid #34e89e;
  outline-offset: 2px;
}

.cookie-modal-description {
  color: #4a5568;
  font-size: 0.95em;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Category rows */

.cookie-category {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cookie-category-title {
  font-weight: 600;
  color: #1a1a2e;
  font-size: 0.95em;
}

.cookie-category-description {
  color: #6b7280;
  font-size: 0.85em;
  margin-top: 8px;
  line-height: 1.5;
}

/* Toggle switch */

.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background 0.25s ease;
}

.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: #34e89e;
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(20px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
  cursor: not-allowed;
  opacity: 0.7;
}

.cookie-toggle input:focus + .cookie-toggle-slider {
  outline: 2px solid #0f3443;
  outline-offset: 2px;
}

/* Essential badge */

.cookie-badge-always {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
}

/* Modal footer */

.cookie-modal-footer {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.cookie-modal-btn {
  padding: 12px 24px;
  border-radius: 24px;
  font-weight: 650;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  border: 2px solid transparent;
  flex: 1;
  text-align: center;
  min-width: 120px;
}

.cookie-modal-btn:focus {
  outline: 2px solid #0f3443;
  outline-offset: 2px;
}

.cookie-modal-btn-primary {
  background: linear-gradient(107deg, #0f3443 0%, #34e89e 100%);
  color: white;
}

.cookie-modal-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.cookie-modal-btn-secondary {
  background: white;
  color: #0f3443;
  border-color: #0f3443;
}

.cookie-modal-btn-secondary:hover {
  background: #f0fdf4;
}

/* ---- Mobile ---- */

@media (max-width: 768px) {
  .cookie-banner {
    padding: 20px 16px;
  }

  .cookie-banner-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .cookie-banner-content {
    min-width: 100%;
  }

  .cookie-banner-buttons {
    flex-direction: column;
    width: 100%;
  }

  .cookie-banner-button {
    width: 100%;
    text-align: center;
  }

  .cookie-modal {
    padding: 24px 20px;
  }

  .cookie-modal-footer {
    flex-direction: column;
  }
}

/* WCAG 2.3.3 — respect user's reduced-motion preference (vestibular disorders) */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-modal,
  .cookie-banner-button,
  .cookie-modal-btn,
  .cookie-toggle-slider,
  .cookie-toggle-slider::before {
    animation: none !important;
    transition: none !important;
  }
}
