/* ================================================================
   HumanELY — "Aurora" theme
   A vibrant, glassmorphic, fully responsive redesign.
   ================================================================ */

:root {
  /* Brand gradients */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 45%, #ec4899 100%);
  --grad-primary-soft: linear-gradient(135deg, rgba(99,102,241,.18), rgba(236,72,153,.18));
  --grad-success: linear-gradient(135deg, #10b981, #22d3ee);
  --grad-warn:    linear-gradient(135deg, #f59e0b, #ef4444);

  /* Accent colors */
  --indigo:  #6366f1;
  --violet:  #a855f7;
  --pink:    #ec4899;
  --teal:    #14b8a6;
  --emerald: #10b981;
  --amber:   #f59e0b;
  --rose:    #f43f5e;

  /* Surfaces (light) */
  --bg: #f4f5fb;
  --bg-deep: #eef0fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 24px 60px rgba(79, 70, 229, 0.22);
  --radius: 18px;
  --radius-sm: 12px;

  /* Likert heat scale */
  --l1: #ef4444;
  --l2: #f97316;
  --l3: #eab308;
  --l4: #84cc16;
  --l5: #10b981;
}

[data-theme="dark"] {
  --bg: #0a0b14;
  --bg-deep: #070812;
  --surface: #141626;
  --surface-2: #1a1d30;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --shadow-sm: 0 4px 14px rgba(0,0,0,0.35);
  --shadow-md: 0 12px 40px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 60px rgba(99,102,241,0.25);
}

/* ---------------- Base layout ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  animation: float 18s ease-in-out infinite alternate;
}
body::before {
  top: -260px;
  left: -180px;
  background: radial-gradient(circle, rgba(99,102,241,0.9), transparent 60%);
}
body::after {
  bottom: -280px;
  right: -220px;
  background: radial-gradient(circle, rgba(236,72,153,0.75), transparent 60%);
  animation-delay: -9s;
}
[data-theme="dark"] body::before { opacity: 0.35; }
[data-theme="dark"] body::after  { opacity: 0.30; }

@keyframes float {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.08); }
}

main { flex: 1; position: relative; z-index: 1; }

a { color: var(--indigo); }
a:hover { color: var(--violet); }

/* ---------------- Navbar ---------------- */
.navbar-aurora {
  background: transparent !important;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}
.navbar-aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.65);
  border-bottom: 1px solid var(--border);
  z-index: -1;
}
[data-theme="dark"] .navbar-aurora::after {
  background: rgba(10,11,20,0.7);
}
.brand-logo {
  display: inline-flex; align-items: center; gap: .7rem;
  font-weight: 700; font-size: 1.15rem; text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad-primary);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; box-shadow: 0 8px 22px rgba(99,102,241,0.45);
  position: relative;
}
.brand-mark::before {
  content: ""; position: absolute; inset: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,255,255,.20), transparent 50%);
  pointer-events: none;
}
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  background: var(--grad-primary-soft);
  color: var(--indigo);
  border: 1px solid rgba(99,102,241,.22);
}
[data-theme="dark"] .pill { color: #c7d2fe; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--violet); }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  padding: 2.4rem 2rem 2.8rem;
  border-radius: 26px;
  background: var(--grad-primary);
  color: white;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(900px 300px at 10% 0%, rgba(255,255,255,0.18), transparent 60%),
    radial-gradient(600px 260px at 90% 100%, rgba(255,255,255,0.15), transparent 60%);
  pointer-events: none;
}
.hero h1 { font-weight: 800; letter-spacing: -0.02em; }
.hero .hero-eyebrow {
  display: inline-flex; gap: .4rem; align-items: center;
  padding: .3rem .75rem;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  backdrop-filter: blur(6px);
}

/* ---------------- Cards ---------------- */
.card-aurora {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-aurora:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card-aurora .card-body { padding: 1.5rem 1.75rem; }

.glass {
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid rgba(255,255,255,0.5);
}
[data-theme="dark"] .glass {
  background: rgba(20,22,38,0.72);
  border-color: rgba(255,255,255,0.08);
}

/* ---------------- Buttons ---------------- */
.btn {
  --bs-btn-border-radius: 12px;
  --bs-btn-padding-x: 1.1rem;
  --bs-btn-padding-y: 0.6rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-gradient {
  background: var(--grad-primary);
  color: #fff;
  border: none;
  box-shadow: 0 10px 28px rgba(99,102,241,0.35);
}
.btn-gradient:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(168,85,247,0.45);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------------- Upload dropzone ---------------- */
.upload-dropzone {
  position: relative;
  border: 2px dashed rgba(99,102,241,0.35);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, rgba(99,102,241,.04), rgba(236,72,153,.04));
  text-align: center;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.upload-dropzone input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  border-color: var(--violet);
  background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(236,72,153,.10));
  transform: translateY(-1px);
}
.upload-icon {
  width: 68px; height: 68px; border-radius: 20px;
  background: var(--grad-primary); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 12px 28px rgba(99,102,241,.35);
  margin-bottom: 1rem;
}

/* ---------------- Metric list on landing ---------------- */
.metric-grid { display: grid; gap: .7rem; }

.metric-pill {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative;
  overflow: hidden;
}
.metric-pill::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--grad-primary);
  opacity: .8;
}
.metric-pill:hover {
  transform: translateX(2px);
  border-color: rgba(99,102,241,.4);
  box-shadow: var(--shadow-sm);
}
.metric-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--indigo);
  background: rgba(99,102,241,.12);
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* ---------------- Evaluate page ---------------- */
.row-header {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 1rem;
}
.row-counter {
  font-size: 1.9rem; font-weight: 800;
  letter-spacing: -0.02em;
}
.row-counter .curr {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* Progress */
.progress-wrap {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar-aurora {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 999px;
  position: relative;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}
.progress-bar-aurora::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,.35) 50%,
    rgba(255,255,255,0) 100%);
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Reference / generated text panels */
.evaluation-layout {
  display: grid;
  gap: 1.5rem;
}
.evaluation-sidebar-inner {
  display: grid;
  gap: 1rem;
}
.context-panel {
  margin-top: .25rem;
}
.text-panel {
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
  height: 100%;
}
.text-panel::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.text-panel.ref::before { background: var(--grad-success); }
.text-panel.gen::before { background: var(--grad-primary); }
.text-panel .label {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .25rem .6rem;
  border-radius: 999px;
  margin-bottom: .6rem;
}
.text-panel.ref .label { color: #047857; background: rgba(16,185,129,.12); }
.text-panel.gen .label { color: var(--indigo); background: rgba(99,102,241,.12); }
[data-theme="dark"] .text-panel.ref .label { color: #6ee7b7; }
[data-theme="dark"] .text-panel.gen .label { color: #c7d2fe; }
.text-body {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: .98rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: .2rem;
  color: var(--text);
}

@media (min-width: 992px) {
  .evaluation-layout {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    align-items: start;
    height: calc(100vh - 8.5rem);
    overflow: hidden;
  }
  .evaluation-sidebar {
    position: relative;
    height: 100%;
  }
  .evaluation-sidebar-inner {
    height: 100%;
    overflow: auto;
    padding-right: .25rem;
  }
  .evaluation-main {
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    padding-right: .35rem;
  }
  .text-body {
    max-height: min(30vh, 320px);
  }
}

/* Metric evaluation card */
.metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  background: var(--surface);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  position: relative;
}
.metric-card:hover {
  border-color: rgba(99,102,241,.32);
  box-shadow: var(--shadow-sm);
}
.metric-head {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: .75rem;
}
.metric-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.metric-desc {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.scale-hint {
  display: inline-flex; gap: .3rem; flex-wrap: wrap;
  font-size: .75rem;
}
.scale-hint .hint {
  padding: .2rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted);
}

.submetric + .submetric {
  margin-top: 1.25rem; padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}
.submetric-label {
  margin-bottom: .55rem;
  color: var(--text);
}
.submetric-label .sm-title {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem;
  text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700;
  color: var(--indigo);
  margin-bottom: .25rem;
}
[data-theme="dark"] .submetric-label .sm-title { color: #c7d2fe; }
.submetric-label .sm-question {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.submetric-label .sm-definition {
  margin-top: .2rem;
  line-height: 1.45;
}
.submetric-label .sm-def {
  color: var(--text-muted);
  cursor: help;
  font-size: .85rem;
}

/* ---- Likert agreement legend ---- */
.likert-legend {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(236,72,153,.08));
  border: 1px solid rgba(99,102,241,.18);
}
.legend-title {
  font-weight: 700; font-size: .95rem;
  margin-bottom: .6rem;
  display: flex; align-items: center; gap: .5rem;
}
.legend-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .5rem;
}
.legend-item {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .78rem;
  color: var(--text);
}
.legend-dot {
  flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
}
.legend-item[data-v="1"] .legend-dot { background: var(--l1); }
.legend-item[data-v="2"] .legend-dot { background: var(--l2); }
.legend-item[data-v="3"] .legend-dot { background: var(--l3); }
.legend-item[data-v="4"] .legend-dot { background: var(--l4); }
.legend-item[data-v="5"] .legend-dot { background: var(--l5); }
.legend-label { font-weight: 500; }

@media (max-width: 767.98px) {
  .legend-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Reverse-coded metric badge ---- */
.reverse-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  background: rgba(244, 63, 94, 0.12);
  color: #be123c;
  border: 1px solid rgba(244, 63, 94, 0.28);
}
[data-theme="dark"] .reverse-badge {
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.2);
}
.metric-card.metric-reverse {
  border-color: rgba(244, 63, 94, 0.22);
}
.metric-card.metric-reverse::after {
  content: "";
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #f43f5e, #f59e0b);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- Likert buttons: color-graded, animated ---- */
.likert-row {
  display: inline-flex; flex-wrap: wrap; gap: .5rem;
}
.likert-btn {
  --lc: var(--indigo);
  min-width: 58px; height: 48px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, box-shadow .12s ease,
              border-color .12s ease, background .12s ease, color .12s ease;
  cursor: pointer;
  margin: 0;
}
.likert-btn[data-v="1"] { --lc: var(--l1); }
.likert-btn[data-v="2"] { --lc: var(--l2); }
.likert-btn[data-v="3"] { --lc: var(--l3); }
.likert-btn[data-v="4"] { --lc: var(--l4); }
.likert-btn[data-v="5"] { --lc: var(--l5); }

.likert-btn:hover {
  transform: translateY(-2px);
  border-color: var(--lc);
  color: var(--lc);
  box-shadow: 0 6px 14px rgba(15, 23, 42, .08);
}
.btn-check:checked + .likert-btn {
  background: var(--lc);
  border-color: var(--lc);
  color: white;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .18);
  animation: pop .25s ease;
}
@keyframes pop {
  0%   { transform: translateY(-2px) scale(.9); }
  60%  { transform: translateY(-2px) scale(1.12); }
  100% { transform: translateY(-2px) scale(1.05); }
}
.btn-check:focus-visible + .likert-btn {
  outline: 3px solid rgba(99,102,241,.35); outline-offset: 2px;
}

/* Sticky action bar */
.action-bar {
  position: sticky;
  bottom: 14px;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.88);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 -2px 18px rgba(15, 23, 42, .06), 0 10px 30px rgba(15, 23, 42, .05);
  z-index: 40;
}
[data-theme="dark"] .action-bar {
  background: rgba(20,22,38,0.82);
}

/* ---------------- Complete screen ---------------- */
.complete-hero {
  text-align: center;
  padding: 3rem 2rem;
  border-radius: 26px;
  background: var(--grad-primary);
  color: white;
  overflow: hidden; position: relative;
  box-shadow: var(--shadow-lg);
}
.complete-hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(500px 200px at 20% 10%, rgba(255,255,255,.2), transparent 60%),
    radial-gradient(400px 180px at 80% 90%, rgba(255,255,255,.2), transparent 60%);
}
.complete-badge {
  width: 112px; height: 112px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
  animation: badgePop .7s cubic-bezier(.17,.67,.5,1.36) both;
}
.complete-badge i {
  font-size: 3rem;
  color: white;
  animation: wobble 1.2s ease .2s;
}
@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes wobble {
  0%,100% { transform: rotate(0); }
  25%     { transform: rotate(-8deg); }
  75%     { transform: rotate(8deg); }
}

/* Confetti */
.confetti {
  position: fixed; inset: 0; pointer-events: none;
  overflow: hidden; z-index: 100;
}
.confetti i {
  position: absolute; top: -20px;
  width: 10px; height: 16px;
  opacity: .9;
  transform-origin: center;
  animation: fall 3s ease-in forwards;
  border-radius: 2px;
}
@keyframes fall {
  0%   { transform: translateY(-40px) rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---------------- Misc ---------------- */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
  font-size: .75rem;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.form-control, .form-control-lg {
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: .7rem 1rem;
}
.form-control:focus, .form-control-lg:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, .18);
}
.form-label { font-weight: 600; font-size: .92rem; }

textarea.form-control { min-height: 80px; }

.alert-soft {
  background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.22);
  color: var(--text);
  border-radius: 14px;
}

.footer {
  padding: 2rem 0;
  color: var(--text-muted);
  text-align: center;
  font-size: .85rem;
  position: relative; z-index: 1;
}

/* Fade-in animation */
.fade-up { animation: fadeUp .45s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 767.98px) {
  .hero { padding: 1.75rem 1.25rem 2rem; border-radius: 22px; }
  .card-aurora .card-body { padding: 1.2rem; }
  .likert-btn { min-width: 48px; height: 44px; font-size: .95rem; }
  .row-counter { font-size: 1.5rem; }
}

/* Kill any Bootstrap outlines that fight our look */
.btn-check:focus + .likert-btn { box-shadow: 0 10px 22px rgba(15,23,42,.18); }
