/* Star Photo Lab — app.css
   DESIGN.md tokens + base styles + components
   No beige / no gold / no serif. Periwinkle accent on cool-gray neutrals. */

:root {
  /* Ink ramp (Uber base) — was periwinkle, now neutral → black.
     Kept the --pw-* names so every existing reference re-skins in place. */
  --pw-50:  #F4F4F5;
  --pw-100: #E7E7EA;
  --pw-200: #D4D4D8;
  --pw-300: #A1A1AA;
  --pw-400: #3F3F46;
  --pw-500: #18181B;   /* primary button (near-black) */
  --pw-600: #000000;
  --pw-700: #000000;

  /* Orange accent (matches the landing page) */
  --accent:     #FF5A1F;
  --accent-600: #ED4C0C;
  --accent-50:  #FFF1EA;

  /* Neutrals */
  --bg:        #FFFFFF;
  --surface:   #FAFAFA;
  --surface-2: #F4F4F5;
  --border:    #E7E7EA;
  --border-2:  #D4D4D8;

  /* Text */
  --text:      #18181B;
  --text-2:    #5B5F6B;
  --text-mut:  #9499A5;

  /* Status */
  --ok:    #1E9E6A;
  --ok-bg: #E7F6EF;
  --warn:  #C2410C;
  --warn-bg:#FBEDE6;
  --bad:   #D1394B;
  --bad-bg:#FBEAEC;
  --info:    var(--accent);
  --info-bg: var(--accent-50);

  /* Typography — Inter to match the landing (system fallback if not loaded) */
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 22px;
  font-weight: 420;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

/* ── Typography helpers ── */
.text-display { font-size: 34px; line-height: 38px; font-weight: 800; letter-spacing: -0.03em; }
.text-h1      { font-size: 24px; line-height: 30px; font-weight: 750; letter-spacing: -0.02em; }
.text-h2      { font-size: 18px; line-height: 24px; font-weight: 700; letter-spacing: -0.015em; }
.text-small   { font-size: 13px; line-height: 18px; font-weight: 450; }
.text-micro   { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tabular      { font-variant-numeric: tabular-nums; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out,
              box-shadow 140ms ease-out, transform 120ms ease-out;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-50); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Busy state (set by btn-loader.js) — blocks repeat presses incl. on <a> links */
.btn.is-loading { pointer-events: none; cursor: progress; opacity: 0.85; }
.btn:disabled, .btn.is-loading { transform: none; box-shadow: none; }

.btn-primary {
  background: var(--pw-500);
  color: #fff;
  border-color: var(--pw-500);
}
.btn-primary:hover  { background: var(--pw-600); border-color: var(--pw-600); }
.btn-primary:active { background: var(--pw-700); border-color: var(--pw-700); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-2);
}
.btn-secondary:hover  { background: var(--surface-2); }
.btn-secondary:active { background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: transparent;
}
.btn-danger:hover { filter: brightness(0.95); }

/* Solid buttons lift slightly on hover (skipped when busy/disabled). */
.btn-primary:hover:not(:disabled):not(.is-loading) { box-shadow: 0 8px 20px -10px rgba(0,0,0,0.45); transform: translateY(-1px); }
.btn-danger:hover:not(:disabled):not(.is-loading)  { transform: translateY(-1px); }

/* ── Button variants (compose with the colour variants above) ── */
.btn-sm   { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 5px; gap: 5px; }
.btn-lg   { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 8px; }
.btn-pill { border-radius: 999px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 38px; padding: 0; }            /* square icon button */
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 46px; }

/* Orange accent button — for the one key CTA on a screen */
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover:not(:disabled):not(.is-loading) { background: var(--accent-600); border-color: var(--accent-600); box-shadow: 0 8px 20px -10px rgba(255,90,31,0.75); transform: translateY(-1px); }
.btn-accent:active { background: var(--accent-600); }

/* ── Input / Label ── */
.field { display: flex; flex-direction: column; gap: 4px; }

.field label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
  outline: none;
}
.input::placeholder { color: var(--text-mut); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.input.error { border-color: var(--bad); }
.input.error:focus { box-shadow: 0 0 0 3px var(--bad-bg); }

/* Number inputs: no stepper arrows (paired with the wheel guard in api.js so
   the scroll wheel never changes a value). */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-error { font-size: 13px; color: var(--bad); margin-top: 2px; }
.field-hint  { font-size: 13px; color: var(--text-mut); margin-top: 2px; }

/* ── Card ── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(20,22,40,.04), 0 1px 3px rgba(20,22,40,.06);
}

/* ── Chip / Status pill ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip-info    { background: var(--info-bg);  color: var(--accent-600); }
.chip-ok      { background: var(--ok-bg);    color: var(--ok); }
.chip-warn    { background: var(--warn-bg);  color: var(--warn); }
.chip-bad     { background: var(--bad-bg);   color: var(--bad); }
.chip-neutral { background: var(--surface-2); color: var(--text-2); }

/* ── Segmented rate control ── */
.rate-control { display: flex; gap: 0; border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden; }
.rate-control input[type=radio] { display: none; }
.rate-control label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--bg);
  cursor: pointer;
  border-right: 1px solid var(--border-2);
  transition: background 140ms ease-out, color 140ms ease-out;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
}
.rate-control label:last-child { border-right: none; }
.rate-control label:hover { background: var(--pw-50); color: var(--pw-600); }
.rate-control input[type=radio]:checked + label {
  background: var(--pw-500);
  color: #fff;
}
.tier-hint { margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: transparent;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mut);
  border-bottom: 2px solid var(--text);   /* strong Uber underline */
  white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td {
  padding: 16px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface); }
.table tbody tr:hover td { background: var(--surface); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Tabs (underline style) ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 140ms ease-out, border-color 140ms ease-out;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Rate filter pills ── */
.rate-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.rate-pill {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.rate-pill:hover { background: var(--accent-50); color: var(--accent-600); border-color: var(--accent); }
.rate-pill.active { background: var(--accent-50); color: var(--accent-600); border-color: var(--accent); }

/* ── Admin shell ── */
.admin-shell { display: flex; height: 100vh; overflow: hidden; }   /* shell never scrolls */
.sidebar {
  width: 220px;
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;            /* sidebar stays put; only its own nav scrolls if huge */
}
.sidebar-logo {
  padding: 22px 20px 18px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.03em;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background 140ms, color 140ms;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--accent-50); color: var(--accent-600); font-weight: 600; }
.sidebar-nav .section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mut);
  padding: 12px 12px 4px;
}

/* Collapsible nav group (e.g. "Designers" → directory, jobs, proofs, payouts). */
.sidebar-nav .nav-group { margin-bottom: 2px; }
.sidebar-nav .nav-group-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 12px; border-radius: 6px; border: none; background: none;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text-2);
  cursor: pointer; text-align: left; margin-bottom: 2px;
  transition: background 140ms, color 140ms;
}
.sidebar-nav .nav-group-btn:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav .nav-group.has-active > .nav-group-btn { color: var(--text); font-weight: 600; }
.sidebar-nav .nav-group-caret { font-size: 10px; color: var(--text-mut); transition: transform 140ms; }
.sidebar-nav .nav-group.open > .nav-group-btn .nav-group-caret { transform: rotate(90deg); }
.sidebar-nav .nav-children { display: none; margin: 2px 0 6px 12px; padding-left: 10px; border-left: 1px solid var(--border); }
.sidebar-nav .nav-group.open .nav-children { display: block; }
.sidebar-nav .nav-children a { font-size: 13px; padding: 7px 12px; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow-y: auto; scrollbar-gutter: stable; }  /* content scrolls here */
/* Lock the background scroll while any modal is open — only the modal scrolls. */
body:has(.modal-back.open) .admin-main { overflow: hidden; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;            /* stays visible while content scrolls */
  top: 0;
  z-index: 5;
  flex-shrink: 0;              /* never compress — identical 68px header on every page */
}
.topbar-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.admin-content { flex: 1; padding: 28px 32px; }

/* ── Alert / banner ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
  margin-bottom: 16px;
}
.alert-error { background: var(--bad-bg); color: var(--bad); border: 1px solid #f5c2c7; }
.alert-ok    { background: var(--ok-bg);  color: var(--ok);  border: 1px solid #a3d9bf; }
.alert-info  { background: var(--info-bg); color: var(--pw-700); border: 1px solid var(--pw-200); }

/* ── Funnel form wrapper ── */
.funnel-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px 80px;
  background: var(--surface);
}
.funnel-header { width: 100%; max-width: 640px; margin-bottom: 32px; }
.funnel-header .brand { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-bottom: 24px; display: block; }
.funnel-header .brand span { color: var(--accent); }
.funnel-form { width: 100%; max-width: 640px; }
.form-section { margin-bottom: 28px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Spinner ── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeletons (loading placeholders) ── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 6px;
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }

/* shapes — compose freely */
.skeleton-text    { height: 12px; border-radius: 4px; }
.skeleton-text + .skeleton-text { margin-top: 9px; }
.skeleton-title   { height: 22px; border-radius: 5px; }
.skeleton-line-sm { height: 9px; border-radius: 4px; }
.skeleton-avatar  { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-thumb   { width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; }
.skeleton-btn     { height: 38px; width: 120px; border-radius: 6px; }
.skeleton-chip    { height: 24px; width: 84px; border-radius: 999px; }
/* width helpers for text rows */
.skeleton-w-25 { width: 25%; } .skeleton-w-40 { width: 40%; } .skeleton-w-50 { width: 50%; }
.skeleton-w-60 { width: 60%; } .skeleton-w-75 { width: 75%; } .skeleton-w-90 { width: 90%; }

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