/* ─────────────────────────────────────────────────────────────────
   Robert Walters · Resume Studio — Design Tokens
   RW charcoal + white + pink-red accent. Dark by default.
   ───────────────────────────────────────────────────────────────── */

:root {
  /* Palette — Robert Walters dark shell (default) */
  --bg:            #242424;
  --bg-elev:       #2C2C2C;
  --bg-inset:      #1C1C1C;
  --ink:           #FFFFFF;
  --ink-2:         #F4F4F4;
  --ink-muted:     #D0D0D0;
  --ink-faint:     #9C9C9C;
  --rule:          #FFFFFF;
  --hairline:      rgba(255,255,255,.10);
  --hairline-2:    rgba(255,255,255,.18);

  --accent:        #FF4B67;
  --accent-ink:    #FF6D84;
  --gold:          #F0C36B;
  --seafoam:       #86D1C2;
  --danger:        #FF7B72;
  --surface-strong:   #252525;
  --surface-strong-2: #303030;

  /* Fonts */
  --font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body:    "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "Menlo", "Consolas", monospace;

  /* Motion */
  --e-out: cubic-bezier(.2,.7,.2,1);
  --e-in:  cubic-bezier(.6,.05,.8,.3);
  --rw-logo-height: 64px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:            #F6F4F1;
  --bg-elev:       #FFFFFF;
  --bg-inset:      #ECE8E1;
  --ink:           #252525;
  --ink-2:         #3A3A3A;
  --ink-muted:     #6C6C6C;
  --ink-faint:     #9D9D9D;
  --rule:          #252525;
  --hairline:      rgba(37,37,37,.10);
  --hairline-2:    rgba(37,37,37,.18);

  --accent:        #FF4B67;
  --accent-ink:    #E83E5D;
  --gold:          #C69D47;
  --seafoam:       #45897B;
  --danger:        #C94D46;
  --surface-strong:   #252525;
  --surface-strong-2: #303030;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  transition: background .5s var(--e-out), color .5s var(--e-out);
}

html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition-duration: .9s !important;
  transition-timing-function: var(--e-out) !important;
  transition-property:
    background,
    background-color,
    border-color,
    box-shadow,
    color,
    fill,
    filter,
    opacity,
    outline-color,
    stroke,
    text-shadow !important;
}

html.theme-switching body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: var(--theme-wash);
  animation: themeWash .96s var(--e-out) both;
  mix-blend-mode: normal;
}

html.theme-switching .nav,
html.theme-switching .nav *,
html.theme-switching .nav *::before,
html.theme-switching .nav *::after,
html.theme-switching .nav::before,
html.theme-switching .nav::after {
  transition: none !important;
}

html.theme-to-light { --theme-wash: #F6F4F1; }
html.theme-to-dark { --theme-wash: #242424; }

@keyframes themeWash {
  0% {
    opacity: .24;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-switching,
  html.theme-switching *,
  html.theme-switching *::before,
  html.theme-switching *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

::selection { background: var(--accent); color: var(--bg); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: clamp(48px, 7vw, 96px); line-height: 1.02; letter-spacing: -.05em; }
h2 { font-size: clamp(32px, 4vw, 56px); line-height: 1.06; letter-spacing: -.04em; }
h3 { font-size: 28px; line-height: 1.15; }
h4 { font-size: 20px; line-height: 1.25; }

p { margin: 0 0 1em; color: var(--ink-muted); }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--hairline-2); transition: border-color .2s; }
a:hover { border-color: var(--accent); }

.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ── Shell ──────────────────────────────────────────────────────── */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.container-tight { max-width: 960px; }
.container-wide  { max-width: 1440px; }

/* ── Top nav ────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  background: #252525;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 40px -28px rgba(0,0,0,.7);
}
.nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #ff4b67 18%, #ff4b67 82%, transparent 100%);
  opacity: 1;
}
.nav-inner {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  /* The full superadmin nav (7 link pills + lang + theme + user + sign out)
     can exceed the container width even on a wide screen. Allow the row to
     wrap so it drops to a tidy second line instead of squishing items
     (which truncated the username to "ad…" and folded "Sign out"). */
  flex-wrap: wrap;
}
/* Nav gets a wider container than page content so the admin link set
   normally stays on one line on desktop before the wrap kicks in. */
.nav .container { max-width: 1440px; }
.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 0;
}
.brand-logo {
  display: block;
  height: var(--rw-logo-height);
  width: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.brand::before {
  content: "";
  width: 5px;
  height: var(--rw-logo-height);
  border-radius: 999px;
  background: #ff4b67;
  box-shadow: 0 0 0 7px rgba(255,75,103,.08);
}
.brand-logo .bl-line { display: block; white-space: nowrap; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -.02em;
  color: var(--ink-muted);
}
.brand-word em {
  font-style: italic;
  color: var(--ink-muted);
  font-weight: 400;
}
.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
}
.nav-links a {
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.65);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 18px;
  border-radius: 999px;
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color .2s, background .2s, border-color .2s;
}
.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.3);
}
.nav-links a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all .3s var(--e-out);
}
/* Keep the language toggle (fixed-width segmented control) from being
   compressed by the flex row. */
.nav-right .lang-seg { flex-shrink: 0; }
.theme-toggle:hover {
  border-color: #ff4b67;
  color: #ff4b67;
  transform: rotate(20deg);
}
.theme-toggle svg { width: 16px; height: 16px; }

/* Sign-out (lives in .nav-right, only when authenticated) */
.logout-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
}
.logout-user {
  font-size: 12px;
  color: rgba(255,255,255,.72);
  letter-spacing: .04em;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 12px;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .2s var(--e-out);
}
.logout-btn:hover {
  border-color: #ff4b67;
  color: #ff4b67;
}
@media (max-width: 720px) {
  .logout-user { display: none; }
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s var(--e-out);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--surface-strong);
  color: #fff;
}
.btn-primary:hover { background: var(--surface-strong-2); box-shadow: 0 10px 24px -12px rgba(0,0,0,.55); }
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-ink); color: #fff; }
.btn:disabled, .btn[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-ghost {
  border-color: var(--hairline-2);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent); background: rgba(255,255,255,.03); }
.btn-lg { padding: 16px 30px; font-size: 15px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%; }
.btn-icon:hover { color: var(--accent); border-color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }

.nav .btn-primary {
  background: #ff4b67;
  color: #fff;
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 10px 24px -16px rgba(255,75,103,.75);
}
.nav .btn-primary:hover {
  background: #ff4967;
  border-color: rgba(255,255,255,.26);
  box-shadow: 0 14px 28px -14px rgba(255,73,103,.85);
}

[data-theme="dark"] .nav .btn-primary {
  background: #ff4b67;
  color: #fff;
  border-color: rgba(255,255,255,.22);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 14px 30px -16px rgba(255,75,103,.9);
}
[data-theme="dark"] .nav .btn-primary:hover {
  background: #ff5a73;
  border-color: rgba(255,255,255,.34);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 18px 34px -16px rgba(255,75,103,.95);
}
.nav .btn-ghost {
  border-color: rgba(255,255,255,.18);
  color: #fff;
}
.nav .btn-ghost:hover {
  border-color: #ff4b67;
  color: #fff;
  background: rgba(255,255,255,.04);
}

@media (max-width: 820px) {
  :root {
    --rw-logo-height: 48px;
  }

  .nav-inner {
    height: auto;
    min-height: 92px;
    padding: 16px 0;
    flex-wrap: wrap;
  }
  .nav-links {
    order: 3;
    width: 100%;
    gap: 18px;
  }
  .nav-right {
    margin-left: auto;
  }
}

/* ── Cards / panels ─────────────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 28px;
}
.card-flat {
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 24px;
}
.hairline { height: 1px; background: var(--hairline); border: 0; margin: 24px 0; }

/* ── Ambient background: grain + radial bloom ─────────────────── */
.ambient {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55% 38% at 82% 0%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 60%),
    radial-gradient(42% 56% at 0% 100%, color-mix(in oklab, var(--gold) 14%, transparent), transparent 68%),
    linear-gradient(180deg, #262626 0%, #242424 50%, #1f1f1f 100%);
  opacity: .9;
  transition: opacity .6s var(--e-out);
}
[data-theme="light"] .ambient {
  background:
    radial-gradient(48% 36% at 84% 0%, rgba(255,75,103,.14), transparent 62%),
    radial-gradient(42% 52% at 0% 100%, rgba(198,157,71,.10), transparent 68%),
    linear-gradient(180deg, #fbfbfa 0%, #f6f4f1 52%, #efede8 100%);
  opacity: 1;
}
.grain {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  opacity: .26;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.18 0 0 0 .08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme="light"] .grain { mix-blend-mode: multiply; opacity: .35; }

/* Particles canvas */
#particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55; }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--hairline);
  padding: 40px 0 60px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Form controls ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}
.input, .textarea, .select {
  font: inherit;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline-2);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent);
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.55; }

/* ── Badges ─────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
}
.tag-accent { color: var(--accent-ink); border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.tag-ok     { color: var(--seafoam); border-color: color-mix(in oklab, var(--seafoam) 50%, transparent); }
.tag-gold   { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 50%, transparent); }
.tag-filled { background: var(--surface-strong); color: #fff; border-color: var(--surface-strong); }

/* ── Progress steps ─────────────────────────────────────────────── */
.steps {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  margin-bottom: 40px;
}
.steps .step {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink);
  padding: 16px 12px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  transition: background .35s var(--e-out), color .35s var(--e-out), transform .35s var(--e-out);
}
.steps .step::before {
  content: attr(data-n);
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .14em;
  color: var(--accent);
}
.steps .step.active {
  border-color: var(--surface-strong);
  background: var(--surface-strong);
  color: #fff;
  box-shadow: none;
}
.steps .step.active::before {
  color: var(--accent);
}
[data-theme="dark"] .steps .step.active {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, var(--bg));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent);
}
.steps .step.done {
  color: color-mix(in oklab, var(--ink) 86%, transparent);
}
.steps .step.done::before {
  content: attr(data-n);
  color: var(--accent);
}
.steps .sep {
  display: none;
}
@media (max-width: 760px) {
  .steps {
    display: grid;
    grid-template-columns: 1fr;
    padding: 24px;
  }
}

/* ── Reveal animation primitives ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s var(--e-out), transform .9s var(--e-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-l { opacity: 0; transform: translateX(-32px); transition: opacity .9s var(--e-out), transform .9s var(--e-out); }
.reveal-l.in { opacity: 1; transform: translateX(0); }
.reveal-r { opacity: 0; transform: translateX(32px); transition: opacity .9s var(--e-out), transform .9s var(--e-out); }
.reveal-r.in { opacity: 1; transform: translateX(0); }

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--e-out), transform .7s var(--e-out);
}
.stagger.in > * { opacity: 1; transform: translateY(0); }
.stagger.in > *:nth-child(1) { transition-delay: .05s; }
.stagger.in > *:nth-child(2) { transition-delay: .12s; }
.stagger.in > *:nth-child(3) { transition-delay: .19s; }
.stagger.in > *:nth-child(4) { transition-delay: .26s; }
.stagger.in > *:nth-child(5) { transition-delay: .33s; }
.stagger.in > *:nth-child(6) { transition-delay: .40s; }
.stagger.in > *:nth-child(7) { transition-delay: .47s; }
.stagger.in > *:nth-child(8) { transition-delay: .54s; }

/* ── Section heading helper ─────────────────────────────────────── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 40px;
}

/* ── Flash messages ─────────────────────────────────────────────── */
.flash-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--hairline-2);
  background: var(--bg-elev);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.flash.success { border-color: color-mix(in oklab, var(--seafoam) 50%, transparent); color: var(--seafoam); }
.flash.danger  { border-color: color-mix(in oklab, var(--danger)  50%, transparent); color: var(--danger); }
.flash.warning { border-color: color-mix(in oklab, var(--gold)    50%, transparent); color: var(--gold); }
.flash.info    { border-color: var(--hairline-2); color: var(--ink-muted); }
.flash .close {
  background: transparent; border: 0; color: currentColor;
  cursor: pointer; font: inherit; font-size: 18px; line-height: 1; padding: 0 4px;
}

/* Fine utility */
.sr-only { position: absolute; left: -9999px; }
.row { display: flex; gap: 24px; flex-wrap: wrap; }
.col { flex: 1; min-width: 0; }
.mt-xs { margin-top: 8px; }
.mt-s { margin-top: 16px; }
.mt-m { margin-top: 32px; }
.mt-l { margin-top: 64px; }
.mt-xl { margin-top: 120px; }
.mb-s { margin-bottom: 16px; }
.mb-m { margin-bottom: 32px; }
.mb-l { margin-bottom: 64px; }
.mb-xl { margin-bottom: 120px; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-muted); }
.text-faint { color: var(--ink-faint); }

/* ── Custom confirm dialog ─────────────────────────────────────────────── */
.rw-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.rw-confirm {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
  padding: 24px 24px 20px;
  max-width: 420px;
  width: 100%;
}
[data-theme="light"] .rw-confirm {
  border-color: rgba(0, 0, 0, .08);
}
.rw-confirm-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.rw-confirm-msg {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.5;
  margin: 0 0 20px;
}
.rw-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
