/* ==========================================================================
   FLEXDASH  Cookie Consent Banner
   --------------------------------------------------------------------------
   GDPR/AVG-vriendelijke consent banner linksonder. GSAP-animaties voor
   entry / expand / exit. Voorkeuren worden lokaal opgeslagen in
   localStorage onder key 'flexdash-cookie-consent'.

   Sluit qua design taal aan op de chat-widget (zelfde radius, shadow,
   spacing). Backend hooks: zoek op "BACKEND:" in cookie-consent.js.
   ========================================================================== */


/* ==========================================================================
   1. CONTAINER
   ========================================================================== */

.cookie-consent {
  position: fixed;
  bottom: var(--space-8);
  left: var(--space-8);
  z-index: 95;
  width: 100%;
  max-width: 360px;
  font-family: var(--font-family);
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
  will-change: transform, opacity;
}

.cookie-consent--ready {
  pointer-events: auto;
}


/* ==========================================================================
   2. CARD
   ========================================================================== */

.cookie-consent__card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
}

/* Subtiele accent-strip bovenaan  matcht logo-vlakken */
.cookie-consent__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--color-accent-blue) 0%,
    var(--color-accent-blue) 50%,
    var(--color-cta) 50%,
    var(--color-cta) 100%
  );
}


/* ==========================================================================
   3. HEADER (icon + titel + dismiss)
   ========================================================================== */

.cookie-consent__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.cookie-consent__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cta);
}

.cookie-consent__icon svg {
  width: 18px;
  height: 18px;
}

.cookie-consent__title-group {
  flex: 1;
  min-width: 0;
}

.cookie-consent__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.cookie-consent__desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 4px 0 0;
}

.cookie-consent__link {
  color: var(--color-accent-blue);
  font-weight: var(--font-weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-consent__link:hover {
  color: var(--color-accent-blue-hover);
}


/* ==========================================================================
   4. ACTIONS (primary buttons)
   ========================================================================== */

.cookie-consent__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-3);
}

.cookie-consent__btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-md);
}

/* "Aanpassen" als text-link onderaan */
.cookie-consent__customize {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.cookie-consent__customize:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.cookie-consent__customize:focus-visible {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: -2px;
}

.cookie-consent__customize-icon {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-base);
}

.cookie-consent--expanded .cookie-consent__customize-icon {
  transform: rotate(180deg);
}


/* ==========================================================================
   5. PREFERENCES PANEL (uitklapbaar)
   ========================================================================== */

.cookie-consent__prefs {
  overflow: hidden;
  max-height: 0;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  will-change: max-height;
}

.cookie-consent__prefs-inner {
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}


/* ----- 5a. Toggle row ----- */

.cookie-pref {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  opacity: 0;
  transform: translateY(8px);
}

.cookie-pref__body {
  flex: 1;
  min-width: 0;
}

.cookie-pref__name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cookie-pref__badge {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-module-green);
  background: rgba(22, 163, 74, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.cookie-pref__desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 4px 0 0;
}


/* ----- 5b. Toggle switch ----- */

.cookie-pref__switch {
  flex-shrink: 0;
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-muted);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  padding: 0;
  margin-top: 2px;
}

.cookie-pref__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.cookie-pref__switch[aria-checked="true"] {
  background: var(--color-accent-blue);
}

.cookie-pref__switch[aria-checked="true"]::after {
  transform: translateX(16px);
}

.cookie-pref__switch[disabled] {
  background: var(--color-module-green);
  opacity: 0.7;
  cursor: not-allowed;
}

.cookie-pref__switch[disabled]::after {
  transform: translateX(16px);
}

.cookie-pref__switch:focus-visible {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}


/* ----- 5c. Save row ----- */

.cookie-consent__save {
  margin-top: var(--space-1);
}


/* ==========================================================================
   6. DARK THEME OVERRIDES
   ========================================================================== */

[data-theme="dark"] .cookie-consent__icon {
  background: var(--bg-surface-raised);
}

[data-theme="dark"] .cookie-pref__badge {
  background: rgba(22, 163, 74, 0.18);
}

[data-theme="dark"] .cookie-pref__switch::after {
  background: #f5f5f5;
}


/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */

@media (max-width: 520px) {
  .cookie-consent {
    bottom: var(--space-4);
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }

  .cookie-consent__actions {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   8. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cookie-consent,
  .cookie-consent__prefs,
  .cookie-pref,
  .cookie-pref__switch::after,
  .cookie-consent__customize-icon {
    transition: none;
  }
}
