/* ═══════════════════════════════════════════════════════════
   AgentsHub Cookie Consent — Premium UI
   Theme via CSS variables on :root / .ah-cc-root
═══════════════════════════════════════════════════════════ */

:root {
  --ah-cc-brand: #24bcca;
  --ah-cc-brand-hover: #1aa8b8;
  --ah-cc-brand-soft: rgba(36, 188, 202, 0.12);
  --ah-cc-brand-ring: rgba(36, 188, 202, 0.35);

  --ah-cc-bg: rgba(255, 255, 255, 0.78);
  --ah-cc-bg-solid: #ffffff;
  --ah-cc-surface: rgba(248, 250, 252, 0.9);
  --ah-cc-border: rgba(15, 23, 42, 0.08);
  --ah-cc-border-strong: rgba(15, 23, 42, 0.12);
  --ah-cc-text: #0f172a;
  --ah-cc-text-muted: #64748b;
  --ah-cc-text-faint: #94a3b8;
  --ah-cc-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 2px 4px rgba(15, 23, 42, 0.02),
    0 12px 32px rgba(15, 23, 42, 0.08),
    0 32px 64px rgba(15, 23, 42, 0.06);
  --ah-cc-radius: 18px;
  --ah-cc-radius-sm: 10px;
  --ah-cc-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  --ah-cc-blur: 20px;
  --ah-cc-overlay: rgba(15, 23, 42, 0.28);
  --ah-cc-success: #16a34a;
  --ah-cc-track: #e2e8f0;
  --ah-cc-track-on: var(--ah-cc-brand);
  --ah-cc-thumb: #ffffff;
  --ah-cc-z: 99999;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-ah-cc-theme='light']) {
    --ah-cc-bg: rgba(15, 23, 42, 0.82);
    --ah-cc-bg-solid: #0f172a;
    --ah-cc-surface: rgba(30, 41, 59, 0.85);
    --ah-cc-border: rgba(255, 255, 255, 0.08);
    --ah-cc-border-strong: rgba(255, 255, 255, 0.12);
    --ah-cc-text: #f8fafc;
    --ah-cc-text-muted: #94a3b8;
    --ah-cc-text-faint: #64748b;
    --ah-cc-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.06),
      0 2px 4px rgba(0, 0, 0, 0.2),
      0 16px 40px rgba(0, 0, 0, 0.35),
      0 40px 80px rgba(0, 0, 0, 0.25);
    --ah-cc-overlay: rgba(0, 0, 0, 0.55);
    --ah-cc-track: #334155;
  }
}

.dark .ah-cc-root,
[data-theme='dark'] .ah-cc-root,
html.dark .ah-cc-root,
:root[data-ah-cc-theme='dark'] {
  --ah-cc-bg: rgba(15, 23, 42, 0.82);
  --ah-cc-bg-solid: #0f172a;
  --ah-cc-surface: rgba(30, 41, 59, 0.85);
  --ah-cc-border: rgba(255, 255, 255, 0.08);
  --ah-cc-border-strong: rgba(255, 255, 255, 0.12);
  --ah-cc-text: #f8fafc;
  --ah-cc-text-muted: #94a3b8;
  --ah-cc-text-faint: #64748b;
  --ah-cc-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 16px 40px rgba(0, 0, 0, 0.35),
    0 40px 80px rgba(0, 0, 0, 0.25);
  --ah-cc-overlay: rgba(0, 0, 0, 0.55);
  --ah-cc-track: #334155;
}

/* ── Root / overlay ─────────────────────────────────────── */

.ah-cc-root {
  position: fixed;
  inset: 0;
  z-index: var(--ah-cc-z);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  font-family: var(--ah-cc-font);
  -webkit-font-smoothing: antialiased;
  pointer-events: none;
}

.ah-cc-root[hidden] {
  display: none !important;
}

.ah-cc-overlay {
  position: absolute;
  inset: 0;
  background: var(--ah-cc-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: auto;
}

.ah-cc-root.ah-cc-open .ah-cc-overlay {
  opacity: 1;
}

/* ── Card ───────────────────────────────────────────────── */

.ah-cc-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin-bottom: env(safe-area-inset-bottom, 0);
  background: var(--ah-cc-bg);
  backdrop-filter: blur(var(--ah-cc-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--ah-cc-blur)) saturate(160%);
  border: 1px solid var(--ah-cc-border);
  border-radius: var(--ah-cc-radius);
  box-shadow: var(--ah-cc-shadow);
  color: var(--ah-cc-text);
  pointer-events: auto;
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s ease;
  overflow: hidden;
}

.ah-cc-root.ah-cc-open .ah-cc-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.ah-cc-root.ah-cc-closing .ah-cc-card {
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition-duration: 0.28s;
}

.ah-cc-root.ah-cc-closing .ah-cc-overlay {
  opacity: 0;
  transition-duration: 0.28s;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ah-cc-card {
    background: var(--ah-cc-bg-solid);
  }
}

@media (min-width: 640px) {
  .ah-cc-root {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
  }

  .ah-cc-card {
    max-width: 420px;
  }
}

/* ── Inner layout ───────────────────────────────────────── */

.ah-cc-inner {
  padding: 22px 22px 18px;
}

.ah-cc-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ah-cc-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ah-cc-brand-soft);
  border: 1px solid rgba(36, 188, 202, 0.18);
  color: var(--ah-cc-brand);
}

.ah-cc-icon svg {
  width: 20px;
  height: 20px;
}

.ah-cc-titles {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.ah-cc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ah-cc-brand);
  margin-bottom: 4px;
}

.ah-cc-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ah-cc-brand);
  box-shadow: 0 0 0 3px var(--ah-cc-brand-soft);
}

.ah-cc-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ah-cc-text);
}

.ah-cc-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ah-cc-text-faint);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.ah-cc-close:hover {
  background: var(--ah-cc-surface);
  color: var(--ah-cc-text-muted);
}

.ah-cc-close:focus-visible {
  outline: 2px solid var(--ah-cc-brand);
  outline-offset: 2px;
}

.ah-cc-close svg {
  width: 16px;
  height: 16px;
}

.ah-cc-body {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ah-cc-text-muted);
}

.ah-cc-note {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ah-cc-text-faint);
}

/* ── Actions ────────────────────────────────────────────── */

.ah-cc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ah-cc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--ah-cc-radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
  user-select: none;
}

.ah-cc-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.ah-cc-btn:focus-visible {
  outline: 2px solid var(--ah-cc-brand);
  outline-offset: 2px;
}

.ah-cc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ah-cc-btn--primary {
  background: var(--ah-cc-brand);
  border: 1px solid transparent;
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 4px 14px rgba(36, 188, 202, 0.35);
}

.ah-cc-btn--primary:hover:not(:disabled) {
  background: var(--ah-cc-brand-hover);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 6px 18px rgba(36, 188, 202, 0.4);
}

.ah-cc-btn--secondary {
  background: transparent;
  border: 1px solid var(--ah-cc-border-strong);
  color: var(--ah-cc-text);
}

.ah-cc-btn--secondary:hover:not(:disabled) {
  background: var(--ah-cc-surface);
  border-color: var(--ah-cc-text-faint);
}

.ah-cc-btn--ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ah-cc-text-muted);
}

.ah-cc-btn--ghost:hover:not(:disabled) {
  background: var(--ah-cc-surface);
  color: var(--ah-cc-text);
}

.ah-cc-btn--full {
  grid-column: 1 / -1;
}

.ah-cc-btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.ah-cc-btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ah-cc-spin 0.6s linear infinite;
  color: #fff;
}

.ah-cc-btn--secondary.is-loading::after,
.ah-cc-btn--ghost.is-loading::after {
  color: var(--ah-cc-brand);
}

@keyframes ah-cc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Customize panel ────────────────────────────────────── */

.ah-cc-panel {
  display: none;
  margin: 0 -22px 4px;
  border-top: 1px solid var(--ah-cc-border);
  border-bottom: 1px solid var(--ah-cc-border);
  background: var(--ah-cc-surface);
  padding: 8px 22px 14px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ah-cc-root.ah-cc-customize .ah-cc-panel {
  display: block;
  animation: ah-cc-panel-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ah-cc-root.ah-cc-customize .ah-cc-main-actions {
  display: none;
}

.ah-cc-root.ah-cc-customize .ah-cc-note {
  display: none;
}

@keyframes ah-cc-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ah-cc-pref {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ah-cc-border);
}

.ah-cc-pref:last-of-type {
  border-bottom: none;
  padding-bottom: 4px;
}

.ah-cc-pref-copy {
  min-width: 0;
}

.ah-cc-pref-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ah-cc-text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.ah-cc-pref-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ah-cc-text-muted);
}

/* Toggle switch */
.ah-cc-switch {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  margin-top: 1px;
}

.ah-cc-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.ah-cc-switch input:disabled {
  cursor: not-allowed;
}

.ah-cc-switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--ah-cc-track);
  transition: background 0.2s ease;
  pointer-events: none;
}

.ah-cc-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ah-cc-thumb);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.ah-cc-switch input:checked + .ah-cc-switch-ui {
  background: var(--ah-cc-track-on);
}

.ah-cc-switch input:checked + .ah-cc-switch-ui::after {
  transform: translateX(18px);
}

.ah-cc-switch input:focus-visible + .ah-cc-switch-ui {
  box-shadow: 0 0 0 3px var(--ah-cc-brand-ring);
}

.ah-cc-switch input:disabled + .ah-cc-switch-ui {
  opacity: 0.7;
}

.ah-cc-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

/* ── Footer link ────────────────────────────────────────── */

.ah-cc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ah-cc-border);
}

.ah-cc-policy {
  font-size: 11.5px;
  color: var(--ah-cc-text-faint);
  text-decoration: none;
  transition: color 0.15s ease;
}

.ah-cc-policy:hover {
  color: var(--ah-cc-brand);
}

.ah-cc-policy:focus-visible {
  outline: 2px solid var(--ah-cc-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.ah-cc-powered {
  font-size: 10.5px;
  color: var(--ah-cc-text-faint);
  letter-spacing: 0.02em;
}

/* ── Reduced motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ah-cc-overlay,
  .ah-cc-card,
  .ah-cc-btn,
  .ah-cc-switch-ui,
  .ah-cc-switch-ui::after,
  .ah-cc-root.ah-cc-customize .ah-cc-panel {
    transition: none !important;
    animation: none !important;
  }

  .ah-cc-card {
    transform: none;
  }

  .ah-cc-root.ah-cc-open .ah-cc-card {
    transform: none;
  }
}
