/* ============================================================
   COOKIE CONSENT v2 — EVER Precision
   ============================================================ */

/* ── Banner (Level 1): floating bottom sheet ── */
.cb-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  z-index: 9000;
  width: calc(100% - 48px);
  max-width: 720px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 2px 8px  rgba(0, 0, 0, 0.06);
  padding: 20px 24px;
  opacity: 0;
  transition:
    transform 480ms cubic-bezier(0.34, 1.2, 0.64, 1),
    opacity   480ms ease;
}

.cb-banner--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.cb-banner-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── Banner content ── */
.cb-banner-content {
  flex: 1;
  min-width: 0;
}

.cb-eyebrow {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.cb-text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.cb-text a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cb-text a:hover { opacity: 0.75; }

/* ── Banner actions ── */
.cb-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

/* ── Buttons (shared) ── */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  transition: opacity 180ms ease, transform 120ms ease;
  text-decoration: none;
}

.cb-btn:hover  { opacity: 0.82; }
.cb-btn:active { transform: scale(0.97); }

.cb-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

.cb-btn--primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.cb-btn--secondary {
  background: transparent;
  color: var(--accent-primary);
  border: 1.5px solid var(--accent-primary);
}

.cb-btn--secondary:hover { opacity: 0.78; }

.cb-btn--tertiary {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding-inline: 6px;
  font-weight: 500;
}

.cb-btn--tertiary:hover {
  opacity: 1;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Overlay ── */
.cb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 9100;
  opacity: 0;
  transition: opacity 300ms ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cb-overlay--visible { opacity: 1; }

/* ── Settings Panel (Level 2) ── */
.cb-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  z-index: 9200;
  width: calc(100% - 48px);
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition:
    transform 360ms cubic-bezier(0.34, 1.2, 0.64, 1),
    opacity   280ms ease;
  outline: none;
}

.cb-panel--visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.cb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 1;
}

.cb-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.cb-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background-color 160ms ease, color 160ms ease;
}

.cb-panel-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.cb-panel-close:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ── Categories ── */
.cb-cats {
  padding: 16px 28px 4px;
}

.cb-cat {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.cb-cat:last-child { border-bottom: none; }

.cb-cat-label {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
}

.cb-cat--locked .cb-cat-label { cursor: default; }

.cb-cat-text {
  flex: 1;
  min-width: 0;
}

.cb-cat-name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cb-cat-desc {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ── Toggle switch ── */
.cb-toggle {
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 26px;
  margin-top: 1px;
}

.cb-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cb-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background-color 220ms ease;
}

.cb-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 220ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.cb-toggle-input:checked + .cb-toggle-track {
  background: var(--accent-primary);
}

.cb-toggle-input:checked + .cb-toggle-track::after {
  transform: translateX(18px);
}

.cb-toggle-input:focus-visible + .cb-toggle-track {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* Locked (necessary): always-on visual */
.cb-toggle--locked {
  width: auto;
  height: auto;
}

.cb-toggle-always {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  opacity: 0.60;
  white-space: nowrap;
}

/* ── Panel Actions ── */
.cb-panel-actions {
  display: flex;
  gap: 10px;
  padding: 20px 28px 28px;
  align-items: center;
}

.cb-panel-actions .cb-btn--primary { flex: 1; }

/* ── Mobile: full-width drawers ── */
@media (max-width: 600px) {
  .cb-banner {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: translateY(calc(100% + 4px));
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  }

  .cb-banner--visible { transform: translateY(0); }

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

  .cb-banner-actions {
    flex-direction: column;
    gap: 8px;
  }

  .cb-btn { justify-content: center; }

  .cb-btn--tertiary {
    padding-inline: 22px;
    color: var(--text-secondary);
  }

  /* Panel slides up from bottom on mobile */
  .cb-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(40px) scale(1);
    opacity: 0;
  }

  .cb-panel--visible {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  .cb-panel-actions {
    flex-direction: column;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .cb-panel-actions .cb-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-banner,
  .cb-overlay,
  .cb-panel,
  .cb-toggle-track,
  .cb-toggle-track::after {
    transition: none;
  }
}
