/* =========================================================
   ReviewQR — design system
   Tokens, resets and primitives shared by every page.
   ========================================================= */

:root {
  /* Surfaces — a cool near-black ramp, each step a real elevation level */
  --bg: #07070c;
  --bg-elevated: #0d0d15;
  --surface: #12121c;
  --surface-2: #181824;
  --border: #24243a;
  --border-strong: #33334f;

  /* Brand */
  --brand: #7c5cfc;
  --brand-bright: #9d84ff;
  --brand-soft: rgba(124, 92, 252, 0.14);
  --accent: #fc5c7c;
  --gradient: linear-gradient(135deg, #7c5cfc 0%, #a855f7 50%, #fc5c7c 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(124, 92, 252, 0.16), rgba(252, 92, 124, 0.09));

  /* Text */
  --text: #f2f2f8;
  --text-muted: #9b9bb8;
  --text-dim: #6e6e8c;

  /* Status */
  --success: #22d3a0;
  --success-soft: rgba(34, 211, 160, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f4557a;
  --danger-soft: rgba(244, 85, 122, 0.12);
  --gold: #fbbf24;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 56px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --shadow-brand: 0 10px 30px rgba(124, 92, 252, 0.32);

  --ring: 0 0 0 3px rgba(124, 92, 252, 0.28);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora', var(--font);
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ambient brand glow — pure decoration, sits behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60rem 32rem at 12% -10%, rgba(124, 92, 252, 0.16), transparent 60%),
    radial-gradient(48rem 28rem at 92% 4%, rgba(252, 92, 124, 0.1), transparent 62%);
}

body > * {
  position: relative;
  z-index: 1;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--brand-bright);
  text-decoration: none;
}

/* Visible, consistent keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection {
  background: rgba(124, 92, 252, 0.4);
  color: #fff;
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Layout primitives ---------- */

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--s-6);
}

/* ---------- Card ---------- */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--s-5);
}

.card-title .icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--gradient);
  font-size: 0.95rem;
  box-shadow: var(--shadow-brand);
}

.card-title small {
  display: block;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0;
}

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease), background-color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  --btn-bg: var(--gradient);
  --btn-fg: #fff;
  --btn-border: transparent;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover:not(:disabled) {
  box-shadow: 0 14px 36px rgba(124, 92, 252, 0.42);
}

.btn--ghost {
  --btn-bg: var(--surface-2);
}
.btn--ghost:hover:not(:disabled) {
  --btn-border: var(--brand);
  color: var(--brand-bright);
}

.btn--danger {
  --btn-fg: var(--danger);
  --btn-bg: var(--danger-soft);
  --btn-border: rgba(244, 85, 122, 0.3);
}
.btn--danger:hover:not(:disabled) {
  --btn-border: var(--danger);
}

.btn--google {
  --btn-bg: #fff;
  --btn-fg: #1f1f28;
  --btn-border: transparent;
  box-shadow: var(--shadow-md);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 15px 24px;
  font-size: 0.98rem;
  border-radius: var(--r-md);
}

.btn--sm {
  padding: 8px 13px;
  font-size: 0.8rem;
  border-radius: var(--r-sm);
}

/* ---------- Form controls ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}

.field > label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.field .req {
  color: var(--accent);
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    background-color 0.2s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-dim);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--border-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
  background: var(--surface);
}

.textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239b9bb8' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.field-error {
  font-size: 0.78rem;
  color: var(--danger);
  min-height: 0;
}

.input[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
}

.char-count {
  align-self: flex-end;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- Chips / pills ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.chip {
  padding: 7px 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s var(--ease);
}

.chip:hover {
  border-color: var(--brand);
  color: var(--brand-bright);
  transform: translateY(-1px);
}

.chip[aria-pressed='true'] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-bright);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  border: 1px solid rgba(124, 92, 252, 0.25);
  color: var(--brand-bright);
  font-size: 0.71rem;
  font-weight: 600;
}

/* ---------- Callouts ---------- */

.note {
  border-radius: var(--r-md);
  padding: 11px 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  border: 1px solid rgba(124, 92, 252, 0.24);
  background: rgba(124, 92, 252, 0.07);
  color: #bcaaff;
}

.note--success {
  border-color: rgba(34, 211, 160, 0.26);
  background: var(--success-soft);
  color: #6ee7c4;
}

.note--danger {
  border-color: rgba(244, 85, 122, 0.28);
  background: var(--danger-soft);
  color: #ff92ab;
}

/* ---------- Spinner & skeleton ---------- */

.spinner {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: center;
  z-index: 999;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.87rem;
  font-weight: 600;
  animation: toast-in 0.28s var(--ease);
}

.toast--success {
  border-color: rgba(34, 211, 160, 0.45);
  color: #6ee7c4;
}
.toast--error {
  border-color: rgba(244, 85, 122, 0.45);
  color: #ff92ab;
}
.toast.is-leaving {
  animation: toast-out 0.25s var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  background: rgba(4, 4, 9, 0.78);
  backdrop-filter: blur(8px);
}

.modal.is-open {
  display: flex;
  animation: fade-in 0.2s var(--ease);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: var(--s-8) var(--s-6);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.26s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
}

/* ---------- Empty state ---------- */

.empty {
  display: grid;
  place-items: center;
  gap: var(--s-3);
  text-align: center;
  padding: var(--s-12) var(--s-6);
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: rgba(18, 18, 28, 0.4);
}

.empty .empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: var(--r-lg);
  background: var(--gradient-subtle);
  border: 1px solid var(--border);
  font-size: 1.7rem;
}

.empty h3 {
  font-size: 1.02rem;
  color: var(--text);
}

.empty p {
  font-size: 0.88rem;
  max-width: 34ch;
}

/* ---------- Utilities ---------- */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
