/* ─────────────────────────────────────────
   Dark theme, yellow accent, animated starfield behind everything
   ───────────────────────────────────────── */

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

:root {
  --bg: #0b0b0d;
  --surface: #18191c;
  --surface-2: #212226;
  --text: #f2f2f2;
  --text-soft: #a6a6ac;
  --text-muted: #6f7076;
  --border: #2c2e33;
  --yellow: #ffd400;
  --yellow-dim: rgba(255, 212, 0, 0.15);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.35);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.3px; }

/* the star canvas sits behind everything else */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* flying star — a little dot with a fading tail, CSS handles all the movement.
   rotate first, then translateX, so it travels in a straight diagonal line
   along the angle it's rotated to (see --rot, set from JS per star) */
.flying-star {
  position: fixed;
  z-index: 0;
  width: 90px;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  border-radius: 2px;
  transform-origin: left center;
  animation: fly 1.6s linear forwards;
}

.flying-star::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.8);
}

@keyframes fly {
  0%   { opacity: 0; transform: rotate(var(--rot)) translateX(0); }
  10%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--rot)) translateX(130vw); }
}

/* ── login ── */
/* fills the screen and centers the login card, both ways, at all sizes */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  max-width: 380px;
  width: 100%;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 30px rgba(255, 212, 0, 0.06);
  animation: float 6s ease-in-out infinite;
}

/* small up/down drift, nothing more */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--yellow);
  color: #111;
  border-radius: 5px;
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--text);
}

.login-card .sub {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

.login-card input::placeholder { color: var(--text-muted); }

.login-card input:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-dim);
}

.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--yellow);
  border: none;
  border-radius: 5px;
  color: #111;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.login-card button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.login-card button:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.95);
}

.login-card button:disabled { cursor: default; opacity: 0.8; }

/* login button dots */
.dots { display: inline-block; }
.dots span {
  display: inline-block;
  animation: dot-bounce 1.2s infinite;
  opacity: 0.35;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 60%, 100% { opacity: 0.35; }
  30% { opacity: 1; }
}

#errorMsg {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
  min-height: 16px;
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 24px;
}

/* ── dashboard shell ── */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
}

.brand span {
  background: var(--yellow);
  color: #111;
  border-radius: 4px;
  padding: 1px 8px;
  margin-left: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--yellow);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.user-name {
  font-size: 14px;
  color: var(--text-soft);
}

.btn-logout {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-logout:hover { background: var(--yellow); color: #111; }

/* ── stat cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 18px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.stat-card:hover { transform: translateY(-2px); }

/* small yellow accent detail on each stat card */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--yellow);
  border-radius: var(--radius) 0 0 var(--radius);
}

.stat-card .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text);
}

.stat-card .sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 8px;
}

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--yellow);
  width: 0%;
  transition: width 0.8s ease;
}

.audit-split {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.audit-split div { font-size: 12px; color: var(--text-soft); }
.audit-split b { display: block; font-size: 14px; font-family: var(--font-mono); color: var(--text); }

.project-split {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.project-split .passed { font-weight: 700; color: var(--yellow); }
.project-split .failed { font-weight: 700; color: var(--text-muted); }

/* ── chart cards ── */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 28px 0 12px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.chart-card:hover { transform: translateY(-2px); }

.chart-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.chart-card.full { grid-column: 1 / -1; }

.chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}

/* skill list */
.skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.skill-name {
  min-width: 90px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
}

.skill-track {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.skill-fill {
  display: block;
  height: 100%;
  background: var(--yellow);
  transition: width 0.6s ease;
}

.skill-value {
  min-width: 24px;
  text-align: right;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-soft);
}

.loading-text {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* ── loading overlay ── */
#loadingOverlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 16px;
}

/* a little core that pulses with rings bursting outward from it, like a
   small star opening up — three elements, two of them just staggered copies
   of the same expanding-ring animation */
.loader-burst {
  position: relative;
  width: 48px;
  height: 48px;
}

.burst-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 10px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 14px 3px rgba(255, 212, 0, 0.65);
  animation: burst-pulse 1.4s ease-in-out infinite;
}

.burst-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 10px;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  opacity: 0;
  animation: burst-out 1.4s ease-out infinite;
}

.burst-ring:nth-child(2) { animation-delay: 0.7s; }

@keyframes burst-out {
  0%   { width: 10px; height: 10px; opacity: 0.8; }
  100% { width: 48px; height: 48px; opacity: 0; }
}

@keyframes burst-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.7; }
}

.loader-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-soft);
  text-transform: uppercase;
}

/* logout uses the same overlay, just adds this class for a nicer send-off */
#loadingOverlay.bye .loader-text {
  font-size: 22px;
  color: var(--yellow);
  text-transform: none;
  animation: bye-pop 0.5s ease;
}

@keyframes bye-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* a handful of stars scattered across the overlay, only fly when .bye is on */
.bye-stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bye-stars span {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--yellow);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px 1px rgba(255, 212, 0, 0.7);
}

.bye-stars span:nth-child(1) { top: 20%; left: 10%; }
.bye-stars span:nth-child(2) { top: 65%; left: 25%; }
.bye-stars span:nth-child(3) { top: 35%; left: 70%; }
.bye-stars span:nth-child(4) { top: 78%; left: 82%; }
.bye-stars span:nth-child(5) { top: 15%; left: 55%; }

#loadingOverlay.bye .bye-stars span {
  animation: bye-fly 1s ease-out forwards;
}
#loadingOverlay.bye .bye-stars span:nth-child(2) { animation-delay: 0.1s; }
#loadingOverlay.bye .bye-stars span:nth-child(3) { animation-delay: 0.2s; }
#loadingOverlay.bye .bye-stars span:nth-child(4) { animation-delay: 0.05s; }
#loadingOverlay.bye .bye-stars span:nth-child(5) { animation-delay: 0.15s; }

@keyframes bye-fly {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.5); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(120px, -80px) scale(1); }
}

.fade-out { opacity: 0; transition: opacity 0.3s; }

/* ── responsive ── */
/* stack the cards on smaller screens */
@media (max-width: 700px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.full { grid-column: 1; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .login-card { padding: 32px 24px; animation: none; } /* skip the float on small screens */
}

[hidden] { display: none !important; }
