/* ============================================================
   NewHope Cookie Consent Banner — nh- prefix, no conflicts
   ============================================================ */

/* ── variables ──────────────────────────────────────────────── */
:root {
  --nh-primary:    #4f46e5;
  --nh-primary-dk: #3730a3;
  --nh-accent:     #7c3aed;
  --nh-text:       #1e293b;
  --nh-muted:      #64748b;
  --nh-border:     #e2e8f0;
  --nh-white:      #ffffff;
  --nh-radius:     16px;
  --nh-radius-sm:  10px;
  --nh-shadow:     0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.10);
  --nh-z:          99999;
}

/* ── overlay ────────────────────────────────────────────────── */
.nh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: calc(var(--nh-z) - 1);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.nh-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── banner wrapper ─────────────────────────────────────────── */
.nh-cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: calc(100% - 32px);
  max-width: 620px;
  z-index: var(--nh-z);
  transition: transform .4s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.nh-cookie-banner.show {
  transform: translateX(-50%) translateY(0);
}

/* ── main card ──────────────────────────────────────────────── */
.nh-cookie-card {
  background: var(--nh-white);
  border-radius: var(--nh-radius);
  box-shadow: var(--nh-shadow);
  border: 1px solid var(--nh-border);
  overflow: hidden;
}

/* gradient top stripe */
.nh-cookie-card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--nh-primary), var(--nh-accent));
}

.nh-cookie-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 0;
}
.nh-cookie-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.nh-cookie-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--nh-text);
  margin: 0 0 4px;
}
.nh-cookie-subtitle {
  font-size: .82rem;
  color: var(--nh-muted);
  margin: 0;
  line-height: 1.45;
}

.nh-cookie-body {
  padding: 12px 22px 0;
  font-size: .84rem;
  color: var(--nh-muted);
  line-height: 1.55;
}
.nh-cookie-policy-link {
  color: var(--nh-primary);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 500;
  display: inline-block;
  margin-top: 4px;
}
.nh-cookie-policy-link:hover { text-decoration: underline; }

/* ── action buttons ─────────────────────────────────────────── */
.nh-cookie-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 22px 20px;
  flex-wrap: wrap;
}
.nh-btn {
  border: none;
  border-radius: var(--nh-radius-sm);
  font-size: .84rem;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.3;
}
.nh-btn-primary {
  background: linear-gradient(135deg, var(--nh-primary), var(--nh-accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
  margin-left: auto;
}
.nh-btn-primary:hover {
  background: linear-gradient(135deg, var(--nh-primary-dk), var(--nh-primary));
  box-shadow: 0 6px 20px rgba(79,70,229,0.45);
  transform: translateY(-1px);
}
.nh-btn-outline {
  background: transparent;
  color: var(--nh-muted);
  border: 1.5px solid var(--nh-border);
}
.nh-btn-outline:hover {
  border-color: #b0b7c3;
  color: var(--nh-text);
  background: #f8fafc;
}
.nh-btn-ghost {
  background: transparent;
  color: var(--nh-primary);
}
.nh-btn-ghost:hover {
  background: #eef2ff;
}
.w-100 { width: 100%; }

/* ── preferences panel ──────────────────────────────────────── */
.nh-prefs-panel {
  background: var(--nh-white);
  border-radius: var(--nh-radius);
  box-shadow: var(--nh-shadow);
  border: 1px solid var(--nh-border);
  margin-bottom: 10px;
  overflow: hidden;
  animation: nhSlideDown .3s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes nhSlideDown {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nh-prefs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--nh-border);
  background: linear-gradient(135deg, #f8f7ff, #f1f0ff);
}
.nh-prefs-header h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--nh-text);
  margin: 0;
}
.nh-prefs-back {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--nh-muted);
  padding: 0 4px;
  line-height: 1;
  border-radius: 6px;
  transition: background .15s;
  font-family: inherit;
}
.nh-prefs-back:hover { background: var(--nh-border); color: var(--nh-text); }

/* ── category rows ──────────────────────────────────────────── */
.nh-cookie-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.nh-cookie-category:last-of-type { border-bottom: none; }
.nh-cookie-category:hover { background: #fafbff; }

.nh-cat-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.nh-cat-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.nh-cat-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--nh-text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nh-cat-desc {
  font-size: .77rem;
  color: var(--nh-muted);
  margin-top: 3px;
  line-height: 1.45;
}
.nh-badge-required {
  font-size: .68rem;
  background: #dcfce7;
  color: #15803d;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── toggle switch ──────────────────────────────────────────── */
.nh-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.nh-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.nh-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: background .2s;
}
.nh-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s cubic-bezier(0.34, 1.5, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.nh-toggle input:checked + .nh-slider { background: var(--nh-primary); }
.nh-toggle input:checked + .nh-slider::before { transform: translateX(20px); }
.nh-toggle-locked { cursor: not-allowed; opacity: .75; }
.nh-toggle-locked .nh-slider { background: #a5b4fc; }
.nh-toggle-locked .nh-slider::before { transform: translateX(20px); }

/* ── prefs footer ───────────────────────────────────────────── */
.nh-prefs-actions { padding: 14px 20px 10px; }
.nh-prefs-note {
  font-size: .72rem;
  color: #94a3b8;
  text-align: center;
  padding: 0 20px 14px;
  margin: 0;
  line-height: 1.5;
}

/* ── cookie settings bar (footer) ───────────────────────────── */
.nh-cookie-settings-btn {
  background: none;
  border: none;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color .15s;
}
.nh-cookie-settings-btn:hover { color: rgba(255,255,255,.85); }

/* ── responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nh-cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: translateY(110%);
    border-radius: 0;
  }
  .nh-cookie-banner.show { transform: translateY(0); }
  .nh-cookie-card {
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .nh-prefs-panel {
    border-radius: 20px 20px 0 0;
    margin-bottom: 0;
    max-height: 80vh;
    overflow-y: auto;
  }
  .nh-cookie-actions {
    flex-direction: column-reverse;
  }
  .nh-btn { width: 100%; text-align: center; }
  .nh-btn-primary { margin-left: 0; }
}
