/* ==========================================================================
   JJ Jenkins — GDPR-Compliant Cookie Consent & Preferences
   Floating Privacy Banner (Bottom-Left) & Centered Preferences Modal
   Design Reference: Clean Floating Card + Expandable Accordions
   Brand Scheme: Deep Navy (#0F1E36), Orange Accent (#FF5C35), Slate (#475569)
   European GDPR & ePrivacy Compliant, WCAG 2.1 AA Compliant
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Shared Typography & Links
   -------------------------------------------------------------------------- */
.cookie-link {
  color: #0F1E36;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.cookie-link:hover,
.cookie-link:focus-visible {
  color: var(--color-orange, #ff5c35);
}

/* --------------------------------------------------------------------------
   2. Button System (Brand-Aligned)
   -------------------------------------------------------------------------- */
.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.cookie-btn:focus-visible {
  outline: 2px solid var(--color-orange, #ff5c35);
  outline-offset: 2px;
}

/* Primary Button (Accept All) */
.cookie-btn--primary {
  background: #0F1E36;
  color: #ffffff;
  border: 1.5px solid #0F1E36;
}

.cookie-btn--primary:hover {
  background: var(--color-orange, #ff5c35);
  border-color: var(--color-orange, #ff5c35);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 92, 53, 0.35);
}

.cookie-btn--primary:active {
  transform: translateY(1px);
}

/* Outline / Reject Button */
.cookie-btn--outline {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.cookie-btn--outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0F1E36;
}

.cookie-btn--outline:active {
  transform: translateY(1px);
}

/* Save Preferences Button */
.cookie-btn--save {
  background: transparent;
  color: #0F1E36;
  border: 1.5px solid #0F1E36;
  font-weight: 700;
}

.cookie-btn--save:hover {
  background: #0F1E36;
  color: #ffffff;
  border-color: #0F1E36;
}

.cookie-btn--save:active {
  transform: translateY(1px);
}

/* Text Button ("Cookie Settings") */
.cookie-btn--text {
  background: transparent;
  color: #0F1E36;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-btn--text:hover {
  color: var(--color-orange, #ff5c35);
}

/* --------------------------------------------------------------------------
   3. Floating Privacy Banner (Bottom-Left Card)
   -------------------------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99999;
  width: 440px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
  font-family: var(--font-body, 'Geist', sans-serif);
}

.cookie-banner.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.cookie-banner__card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 16px 48px -4px rgba(15, 30, 54, 0.18), 0 4px 16px rgba(15, 30, 54, 0.08);
  padding: 24px 24px 20px 24px;
  box-sizing: border-box;
}

.cookie-banner__title {
  margin: 0 0 10px 0;
  font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  color: #0F1E36;
  letter-spacing: -0.01em;
}

.cookie-banner__desc {
  margin: 0 0 20px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #475569;
}

.cookie-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   4. Preferences Modal Overlay & Backdrop
   -------------------------------------------------------------------------- */
.jj-cookie-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 25, 47, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-body, 'Geist', sans-serif);
}

.jj-cookie-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.jj-cookie-backdrop {
  position: absolute;
  inset: 0;
  cursor: default;
}

/* --------------------------------------------------------------------------
   5. Preferences Modal Card
   -------------------------------------------------------------------------- */
.cookie-modal-card {
  position: relative;
  z-index: 2;
  width: 580px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  background: #ffffff;
  color: #101418;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(10, 25, 47, 0.35);
  border: 1px solid #e2e8f0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  box-sizing: border-box;
  margin: auto;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-modal-card::-webkit-scrollbar {
  width: 6px;
}

.cookie-modal-card::-webkit-scrollbar-track {
  background: transparent;
}

.cookie-modal-card::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.cookie-modal-card::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

.jj-cookie-overlay.is-active .cookie-modal-card {
  transform: scale(1) translateY(0);
}

.cookie-modal-card:focus {
  outline: none;
}

/* Close ✕ Button */
.cookie-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.cookie-modal__close:hover {
  background: #f1f5f9;
  color: #0F1E36;
}

.cookie-modal__close:focus-visible {
  outline: 2px solid var(--color-orange, #ff5c35);
  outline-offset: 2px;
}

/* Header */
.cookie-modal__header {
  margin-bottom: 20px;
  padding-right: 36px;
}

.cookie-modal__title {
  margin: 0 0 10px 0;
  font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: #0F1E36;
  letter-spacing: -0.01em;
}

.cookie-modal__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
}

/* --------------------------------------------------------------------------
   6. Category Accordions
   -------------------------------------------------------------------------- */
.cookie-modal__categories {
  display: flex;
  flex-direction: column;
}

.cookie-accordion {
  border-top: 1px solid #e2e8f0;
  padding: 14px 0;
}

.cookie-accordion:last-child {
  border-bottom: 1px solid #e2e8f0;
}

.cookie-accordion__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.cookie-accordion__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  outline: none;
}

.cookie-accordion__header-row .cookie-accordion__header {
  width: auto;
  flex: 1;
}

.cookie-accordion__header:focus-visible {
  outline: 2px solid var(--color-orange, #ff5c35);
  outline-offset: 4px;
  border-radius: 4px;
}

.cookie-accordion__title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cookie-accordion__chevron {
  color: #0F1E36;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Invert chevron when open / closed */
.cookie-accordion.is-open .cookie-accordion__chevron {
  transform: rotate(0deg);
}

.cookie-accordion:not(.is-open) .cookie-accordion__chevron {
  transform: rotate(180deg);
}

.cookie-accordion__title {
  font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: #0F1E36;
}

.cookie-accordion__status {
  font-family: var(--font-heading, 'Manrope', sans-serif);
  font-size: 12px;
  font-weight: 700;
  color: #0F1E36;
  background: #e2e8f0;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cookie-accordion__content {
  padding: 10px 0 4px 24px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #475569;
}

.cookie-accordion:not(.is-open) .cookie-accordion__content {
  display: none;
}

.cookie-accordion__content p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   7. Modern iOS-Style Toggle Switch
   -------------------------------------------------------------------------- */
.cookie-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin: 0;
}

.cookie-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.cookie-toggle__track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.cookie-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 30, 54, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-toggle__input:checked + .cookie-toggle__track {
  background: #0F1E36;
}

.cookie-toggle__input:checked + .cookie-toggle__track .cookie-toggle__thumb {
  transform: translateX(20px);
}

.cookie-toggle__input:focus-visible + .cookie-toggle__track {
  outline: 2px solid var(--color-orange, #ff5c35);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   8. Modal Actions
   -------------------------------------------------------------------------- */
.cookie-modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   9. Persistent Footer Trigger Button
   -------------------------------------------------------------------------- */
.cookie-settings-btn {
  background: none;
  border: none;
  padding: 4px 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  transition: color 0.2s ease;
}

.cookie-settings-btn:hover {
  color: var(--color-orange, #ff5c35);
  text-decoration: underline;
}

.cookie-settings-btn:focus-visible {
  outline: 2px solid var(--color-orange, #ff5c35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   10. Responsive Styles
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: none;
  }

  .cookie-banner__card {
    padding: 20px;
  }

  .cookie-banner__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

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

  .cookie-modal-card {
    padding: 24px 18px;
    border-radius: 14px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .cookie-modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

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

/* --------------------------------------------------------------------------
   11. Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .jj-cookie-overlay,
  .cookie-modal-card,
  .cookie-modal__close,
  .cookie-accordion__chevron,
  .cookie-toggle__track,
  .cookie-toggle__thumb,
  .cookie-btn {
    transition: none !important;
    transform: none !important;
  }
}
