/* ============================================================
   iZOOlogic Assessment — Design System
   Light + auto dark via prefers-color-scheme. No toggle.
   ============================================================ */

:root {
  --bg:           #f6f8fb;
  --bg-elevated:  #ffffff;
  --bg-soft:      #eef2f7;
  --text:         #0a0e1a;
  --text-muted:   #5b6573;
  --text-subtle:  #94a3b8;
  --border:       #e3e8ef;
  --border-strong:#cbd5e1;
  --accent:       #00c46a;
  --accent-dark:  #00a35a;
  --accent-fg:    #002915;
  --accent-soft:  rgba(0, 196, 106, 0.10);
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --success:      #10b981;
  --info:         #3b82f6;
  --shadow-sm:    0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md:    0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.05);
  --shadow-lg:    0 18px 40px rgba(15,23,42,.14), 0 6px 12px rgba(15,23,42,.06);
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --header-h:     68px;
  --content-max:  960px;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0a0e15;
    --bg-elevated:  #141a24;
    --bg-soft:      #1c2330;
    --text:         #e6edf3;
    --text-muted:   #93a1b3;
    --text-subtle:  #6b7686;
    --border:       #232b38;
    --border-strong:#39424f;
    --accent:       #00e886;
    --accent-dark:  #00d27a;
    --accent-fg:    #001f10;
    --accent-soft:  rgba(0, 232, 134, 0.12);
    --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
    --shadow-md:    0 4px 12px rgba(0,0,0,.5);
    --shadow-lg:    0 18px 40px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1rem; color: var(--text); }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.small { font-size: .82rem; }

/* ============================================================ Layout */

.container { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 1.25rem; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 38px; width: auto; }
.header-nav { display: flex; gap: 1.25rem; align-items: center; }
.nav-link { color: var(--text); font-weight: 600; font-size: .92rem; padding: .35rem .25rem; border-bottom: 2px solid transparent; transition: border-color .2s, color .2s; }
.nav-link:hover { color: var(--accent-dark); border-bottom-color: var(--accent); text-decoration: none; }
.nav-link-muted { color: var(--text-muted); font-weight: 500; }

.main-area { flex: 1; padding: 2rem 1.25rem 4rem; animation: fadeUp .4s cubic-bezier(.4,0,.2,1); }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.25rem 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .8px;
}
.site-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--text-muted); }
.footer-secure { color: var(--accent-dark); font-weight: 600; }

/* ============================================================ Hero */

.hero { text-align: center; padding: 1.5rem 0 2.25rem; }
.hero-eyebrow { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: 2px; color: var(--accent-dark); margin-bottom: .75rem; }
.hero-title { margin: .25rem 0 .5rem; }
.hero-sub { color: var(--text-muted); max-width: 560px; margin: 0 auto; font-size: 1rem; }

/* ============================================================ Cards */

.card-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.assess-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: .75rem;
  box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s, border-color .25s;
  animation: fadeUp .5s cubic-bezier(.4,0,.2,1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
.assess-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.assess-card-head { display: flex; align-items: center; justify-content: space-between; }
.meta-time { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }
.assess-card-title { margin: 0; font-size: 1.15rem; }
.assess-card-desc { color: var(--text-muted); font-size: .92rem; margin: 0 0 .5rem; flex: 1; min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .5rem; }
.empty-line { color: var(--text-muted); padding: 2rem 0; text-align: center; }

/* ============================================================ Badges */

.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: .68rem; font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge-public  { background: var(--accent-soft); color: var(--accent-dark); border-color: rgba(0,196,106,.3); }
.badge-private { background: rgba(245,158,11,.10); color: #b45309; border-color: rgba(245,158,11,.3); }
@media (prefers-color-scheme: dark) { .badge-private { color: #fbbf24; } }
.badge-success { background: rgba(16,185,129,.12); color: var(--success); border-color: rgba(16,185,129,.3); }
.badge-muted   { background: var(--bg-soft); color: var(--text-muted); border-color: var(--border); }

/* ============================================================ Forms */

.form-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 0 auto 1.5rem;
  box-shadow: var(--shadow-md);
  max-width: 640px;
  animation: fadeUp .4s cubic-bezier(.4,0,.2,1);
}
.form-card.narrow { max-width: 440px; }
.form-card-eyebrow { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: 2px; color: var(--accent-dark); margin-bottom: .5rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .grid-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--text); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 90px; }
.checkbox { display: flex; gap: .65rem; align-items: flex-start; font-size: .9rem; color: var(--text-muted); }
.checkbox input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; }

.meta-row { display: flex; gap: .75rem; align-items: center; color: var(--text-muted); font-size: .9rem; margin: .75rem 0 0; }
.meta-row .dot { color: var(--border-strong); }
.meta-row b { color: var(--text); font-weight: 600; }

.back-link { display: inline-block; margin-top: .25rem; color: var(--text-muted); font-size: .9rem; text-align: center; }
.back-link:hover { color: var(--accent-dark); }

/* ============================================================ Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.4rem;
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s, background .18s, border-color .18s;
  min-height: 44px;
}
.btn:hover { background: var(--bg-soft); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.6rem; font-size: 1rem; }
.btn-primary {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-soft);
}
.btn-primary:hover {
  background: var(--accent-dark); border-color: var(--accent-dark);
  box-shadow: 0 8px 24px var(--accent-soft), 0 0 0 1px var(--accent);
  color: var(--accent-fg);
}
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(239,68,68,.4); }
.btn-danger:hover { background: rgba(239,68,68,.08); border-color: var(--danger); color: var(--danger); }

/* ============================================================ Flash */

.flash-stack { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: .92rem;
  animation: fadeUp .3s ease;
}
.flash-info    { border-left-color: var(--info); }
.flash-success { border-left-color: var(--success); background: rgba(16,185,129,.06); }
.flash-error   { border-left-color: var(--danger); background: rgba(239,68,68,.06); color: var(--danger); }
.flash-warn    { border-left-color: var(--warning); background: rgba(245,158,11,.06); color: #b45309; }
@media (prefers-color-scheme: dark) { .flash-warn { color: #fbbf24; } }

/* ============================================================ Assessment page */

.timer-bar {
  position: sticky; top: var(--header-h); z-index: 60;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a2235 100%);
  color: #fff;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 196, 106, 0.35);
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
  font-family: var(--font-sans);
}
.timer-bar.warn { border-color: rgba(245, 158, 11, 0.55); }
.timer-bar.urgent { border-color: rgba(239, 68, 68, 0.65); animation: pulseUrgent 1s ease-in-out infinite; }
@keyframes pulseUrgent {
  0%,100% { box-shadow: 0 8px 22px rgba(239,68,68,.25); }
  50%     { box-shadow: 0 8px 32px rgba(239,68,68,.65); }
}
.timer-eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: 1.5px; color: #00e886; }
.timer-eyebrow.muted { color: #9ca3af; }
.timer-title { font-weight: 600; font-size: 1rem; margin-top: 2px; color: #fff; }
.timer-display { font-family: var(--font-mono); font-size: 1.65rem; font-weight: 700; color: #00e886; margin-top: 2px; }
.timer-bar.warn .timer-display { color: #fbbf24; }
.timer-bar.urgent .timer-display { color: #fca5a5; }

.assessment-form { max-width: 760px; margin: 0 auto; }
.hello-row { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1.25rem; color: var(--text-muted); font-size: .92rem; }
.hello-row b { color: var(--text); }

.question-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow-sm);
  animation: fadeUp .35s cubic-bezier(.4,0,.2,1) backwards;
  animation-delay: calc(var(--i, 0) * 40ms + 100ms);
}
.q-eyebrow { font-family: var(--font-mono); font-size: .68rem; font-weight: 600; letter-spacing: 1.5px; color: var(--accent-dark); padding: 0; }
.q-text { font-size: 1.02rem; font-weight: 500; margin: .5rem 0 1rem; white-space: pre-wrap; line-height: 1.55; }
.q-options { display: flex; flex-direction: column; gap: .5rem; }
.opt {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .8rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; }
.opt-letter { font-family: var(--font-mono); font-weight: 700; color: var(--accent-dark); min-width: 18px; }
.opt-text { flex: 1; }

/* ============================================================ Thank-You */

.thank-you-card {
  position: relative;
  margin: 1rem auto;
  padding: 3rem 2.25rem 2.25rem;
  max-width: 620px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeUp .55s cubic-bezier(.4,0,.2,1);
}
.ty-glow {
  position: absolute; inset: -50% -20% auto -20%;
  height: 220px; pointer-events: none;
  background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 65%);
  filter: blur(10px);
}
.ty-check {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  animation: tyPop .55s cubic-bezier(.34,1.56,.64,1) .1s backwards;
}
@keyframes tyPop { 0%{transform:scale(.4);opacity:0;} 70%{transform:scale(1.08);opacity:1;} 100%{transform:scale(1);} }
.ty-check-circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: tyDraw .7s ease-out .3s forwards; }
.ty-check-tick   { stroke-dasharray:  50; stroke-dashoffset:  50; animation: tyDraw .4s ease-out .9s forwards; }
@keyframes tyDraw { to { stroke-dashoffset: 0; } }

.ty-title { position: relative; font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 800; margin: .25rem 0 .5rem; }
.ty-sub { position: relative; color: var(--text-muted); font-size: 1rem; margin: 0 0 1.5rem; }
.ty-divider { position: relative; width: 60px; height: 3px; margin: 0 auto 1.5rem; background: linear-gradient(90deg, transparent, var(--accent), transparent); border-radius: 2px; }
.ty-message { position: relative; color: var(--text-muted); font-size: .95rem; line-height: 1.65; max-width: 480px; margin: 0 auto 1.75rem; }
.ty-wish {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: .85rem 1.5rem;
  background: var(--accent-soft);
  border: 1px solid rgba(0,196,106,.35);
  border-radius: 999px;
  color: var(--accent-dark);
  font-weight: 600; font-size: .95rem;
  animation: fadeIn .6s ease .8s backwards;
}
.ty-wish-icon { font-size: 1.15rem; display: inline-block; animation: tyWave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes tyWave { 0%,100%{transform:rotate(-8deg);} 50%{transform:rotate(12deg);} }
.ty-footer { position: relative; margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: .72rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }
.ty-footer b { color: var(--text); font-weight: 700; }

/* ============================================================ Admin */

.admin-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 2rem; overflow-x: auto; }
.tab { padding: .75rem 1.1rem; font-weight: 600; font-size: .92rem; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.section-title { margin: 2rem 0 1rem; font-size: 1.05rem; }
.admin-row { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .65rem; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.admin-row:hover { border-color: var(--border-strong); }
.admin-row[open] { box-shadow: var(--shadow-sm); }
.admin-row summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; cursor: pointer; list-style: none; font-weight: 600; }
.admin-row summary::-webkit-details-marker { display: none; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.admin-row-body { padding: 1rem 1.1rem 1.25rem; border-top: 1px solid var(--border); }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

.filter-row { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.25rem; max-width: 480px; }

.results-head { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0; gap: 1rem; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.results-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.results-table th, .results-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.results-table th { background: var(--bg-soft); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.results-table tbody tr:hover { background: var(--bg-soft); }
.pct { font-family: var(--font-mono); font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.pct-good { color: var(--success); background: rgba(16,185,129,.12); }
.pct-ok   { color: var(--warning); background: rgba(245,158,11,.12); }
.pct-bad  { color: var(--danger); background: rgba(239,68,68,.12); }

/* ============================================================ Animations */

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================ Responsive */

@media (max-width: 640px) {
  .header-nav { gap: .8rem; }
  .nav-link { font-size: .85rem; }
  .brand img { height: 32px; }
  .form-card { padding: 1.5rem; }
  .timer-bar { padding: 12px 16px; }
  .timer-display { font-size: 1.4rem; }
  .question-card { padding: 1.1rem 1.15rem; }
  .results-table th, .results-table td { padding: .55rem .75rem; }
}
