/**
 * AlQuanun website — consent UI (copied from the NeedleSearch module).
 *
 * Every colour is a var() with a literal fallback, so the same file works on the
 * landing page (which does not load the app token sheet) and inside the app (where
 * it inherits --text / --bg / --border and follows the theme).
 */

.ns-cc-root {
  --ns-cc-bg: var(--bg, #ffffff);
  --ns-cc-fg: var(--text, #111827);
  --ns-cc-dim: var(--muted, #6b7280);
  --ns-cc-border: var(--border, #e5e7eb);
  --ns-cc-accent: var(--file-item-active-text, #1f4fd8);
  --ns-cc-radius: var(--radius-sm, 10px);
  --ns-cc-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  font-family: inherit;
}

.ns-cc-root > * {
  pointer-events: auto;
}

@media (prefers-color-scheme: dark) {
  .ns-cc-root {
    --ns-cc-bg: var(--bg, #14161a);
    --ns-cc-fg: var(--text, #e8eaed);
    --ns-cc-dim: var(--muted, #9aa0a6);
    --ns-cc-border: var(--border, #2c2f36);
    --ns-cc-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}

/* ─── Bars (strict, optout, info) ─────────────────────────────────────────── */

.ns-cc-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 24px;
  background: var(--ns-cc-bg);
  color: var(--ns-cc-fg);
  border-top: 1px solid var(--ns-cc-border);
  box-shadow: var(--ns-cc-shadow);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.24s ease-out, opacity 0.24s ease-out;
}

.ns-cc-bar.ns-cc-in {
  transform: translateY(0);
  opacity: 1;
}

.ns-cc-bar-slim {
  padding: 12px 24px;
}

.ns-cc-copy {
  flex: 1 1 320px;
  min-width: 0;
}

.ns-cc-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ns-cc-fg);
}

.ns-cc-bar-slim .ns-cc-title {
  display: none;
}

.ns-cc-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ns-cc-dim);
}

.ns-cc-link {
  color: var(--ns-cc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ns-cc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

/* Reject and Accept share a size, weight and padding on purpose: under the EDPB's
   dark-pattern guidance a visually subordinate "reject" is not a free choice. */
.ns-cc-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 10px 16px;
  border-radius: var(--ns-cc-radius);
  border: 1px solid var(--ns-cc-border);
  background: transparent;
  color: var(--ns-cc-fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.ns-cc-btn:hover {
  background: color-mix(in srgb, var(--ns-cc-fg) 6%, transparent);
}

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

.ns-cc-btn-primary {
  background: var(--ns-cc-accent);
  border-color: transparent;
  color: #fff;
}

.ns-cc-btn-primary:hover {
  background: color-mix(in srgb, var(--ns-cc-accent) 88%, #000);
}

.ns-cc-btn-secondary {
  background: transparent;
  border-color: var(--ns-cc-border);
}

.ns-cc-btn-ghost {
  border-color: transparent;
  color: var(--ns-cc-dim);
  padding-left: 12px;
  padding-right: 12px;
}

.ns-cc-btn-close {
  border: none;
  background: transparent;
  color: var(--ns-cc-dim);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
}

/* ─── Backdrop and dialogs ────────────────────────────────────────────────── */

.ns-cc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.ns-cc-backdrop-soft {
  background: rgba(0, 0, 0, 0.3);
}

.ns-cc-dialog,
.ns-cc-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--ns-cc-bg);
  color: var(--ns-cc-fg);
  border: 1px solid var(--ns-cc-border);
  border-radius: calc(var(--ns-cc-radius) + 4px);
  box-shadow: var(--ns-cc-shadow);
  padding: 24px;
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.ns-cc-dialog.ns-cc-in,
.ns-cc-modal.ns-cc-in {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.ns-cc-dialog .ns-cc-actions {
  margin-top: 20px;
  justify-content: flex-end;
}

.ns-cc-modal {
  padding: 0;
  width: min(560px, calc(100vw - 32px));
}

.ns-cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
}

.ns-cc-modal-body {
  padding: 0 24px 4px;
}

.ns-cc-modal-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--ns-cc-border);
  margin-top: 12px;
}

.ns-cc-note,
.ns-cc-gpc {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ns-cc-dim);
  padding: 10px 12px;
  border-radius: var(--ns-cc-radius);
  background: color-mix(in srgb, var(--ns-cc-fg) 4%, transparent);
}

.ns-cc-gpc {
  border-left: 3px solid var(--ns-cc-accent);
}

/* ─── Category rows ───────────────────────────────────────────────────────── */

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

.ns-cc-row:last-child {
  border-bottom: none;
}

.ns-cc-row-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
}

.ns-cc-row-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ns-cc-dim);
}

.ns-cc-row-control {
  flex-shrink: 0;
  padding-top: 2px;
}

.ns-cc-always {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ns-cc-dim);
}

.ns-cc-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

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

.ns-cc-slider {
  position: absolute;
  inset: 0;
  background: var(--ns-cc-border);
  border-radius: 999px;
  transition: background 0.18s;
  pointer-events: none;
}

.ns-cc-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
}

.ns-cc-switch input:checked + .ns-cc-slider {
  background: var(--ns-cc-accent);
}

.ns-cc-switch input:checked + .ns-cc-slider::before {
  transform: translateX(18px);
}

.ns-cc-switch input:focus-visible + .ns-cc-slider {
  outline: 2px solid var(--ns-cc-accent);
  outline-offset: 2px;
}

/* ─── Small screens ───────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .ns-cc-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
  }

  .ns-cc-actions {
    justify-content: stretch;
  }

  /* Full-width and equal — the reject button must not become the small one on
     mobile, which is where that dark pattern usually appears. */
  .ns-cc-actions .ns-cc-btn {
    flex: 1 1 0;
    text-align: center;
  }

  .ns-cc-modal-footer .ns-cc-btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ns-cc-bar,
  .ns-cc-dialog,
  .ns-cc-modal {
    transition: none;
  }
}
