/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}
@keyframes hero-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.animate-fade-in { animation: fadeIn 0.25s ease-out; }
.animate-slide-up { animation: slideUp 0.3s ease-out; }
.animate-toast-in { animation: toast-in 0.3s ease-out; }
.animate-toast-out { animation: toast-out 0.25s ease-in forwards; }
.animate-pulse-dot { animation: pulse-dot 1.5s ease-in-out infinite; }

/* Stepper */
.stepper-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #e5e7eb;
  transform: translateY(-50%);
  z-index: 0;
}
.stepper-line-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.5s ease;
}
.stepper-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stepper-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}
.stepper-dot--pending   { background: #f3f4f6; color: #9ca3af; border: 2px solid #d1d5db; }
.stepper-dot--active    { background: #2563eb; color: white; border: 2px solid #2563eb; box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }
.stepper-dot--done      { background: #059669; color: white; border: 2px solid #059669; }
.stepper-dot--interrupt { background: #f59e0b; color: white; border: 2px solid #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.2); }
.stepper-label {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.stepper-label--active { color: #2563eb; font-weight: 600; }

/* Score bar */
.score-bar-track { background: #e5e7eb; height: 6px; border-radius: 3px; overflow: hidden; }
.score-bar-fill  { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* Card hover */
.card-selectable { transition: box-shadow 0.15s ease, border-color 0.15s ease; cursor: pointer; }
.card-selectable:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card-selectable.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(20, 167, 91, 0.3); }

/* Tab bar */
.tab-btn { transition: color 0.15s, border-color 0.15s; }
.tab-btn.active { color: #2563eb; border-bottom: 2px solid #2563eb; }

/* Icon nav buttons (header) */
.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.15s, opacity 0.15s;
}
.nav-icon-btn:hover { background-color: rgba(255,255,255,0.1); }

/* Active nav — header bar */
.nav-tab.active { color: #2563eb; }
header .nav-tab.active { color: #fff; font-weight: 600; }
header .nav-tab { opacity: 0.75; }
header .nav-tab.active { opacity: 1; }

/* Admin sub-links active highlight */
.admin-sub-link.active-sub { background-color: #eff6ff; color: #2563eb; }

/* Drag-drop zone */
.drop-zone { transition: border-color 0.2s, background-color 0.2s; }
.drop-zone.drag-over { border-color: #2563eb; background-color: #eff6ff; }

/* Feedback textarea slide */
.feedback-area {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.feedback-area.open {
  max-height: 200px;
  padding-top: 12px;
}

/* Mobile stepper vertical */
@media (max-width: 639px) {
  .stepper-wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  .stepper-line { display: none; }
  .stepper-node { flex-direction: row; gap: 8px; }
  .stepper-label { max-width: none; }
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Hero section ===== */

.hero-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  margin-top: -1.5rem;
  margin-bottom: -1.5rem;
  min-height: calc(100vh - 80px);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 25%, #7c3aed 50%, #2563eb 75%, #0f172a 100%);
  background-size: 400% 400%;
  animation: hero-flow 20s ease infinite;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  animation: hero-float 6s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero-subtitle {
  margin-top: 1.25rem;
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.hero-cta {
  margin-top: 2.5rem;
}

.hero-btn {
  display: inline-block;
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 9999px;
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.55);
}

/* ===== Nav grid (signed-in home) ===== */

.home-grid {
  display: grid;
  gap: 1rem;
  grid-auto-rows: 1fr;
}
.home-grid[data-cols="1"] { grid-template-columns: 1fr; }
.home-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.home-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
}
.home-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

/* Medium — 2-col grid, no descriptions */
@media (max-width: 767px) {
  .home-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .home-card-desc { display: none; }
}

/* Small — 1-col grid, icon only */
@media (max-width: 479px) {
  .home-grid { grid-template-columns: 1fr !important; }
  .home-card-title { display: none; }
  .home-card { padding: 1.25rem 1rem; }
}

/* ===== Dark color scheme ===== */

html.dark {
  color-scheme: dark;
  background-color: #0B0F14;
}

/* Surfaces */
html.dark.bg-gray-50,
.dark .bg-gray-50  { background-color: #0B0F14 !important; }
.dark .bg-white    { background-color: #141A22 !important; }
.dark .bg-gray-100 { background-color: #1A2230 !important; }
.dark .bg-gray-200 { background-color: #252F3D !important; }

/* Text */
.dark .text-gray-900 { color: #F2F5F7 !important; }
.dark .text-gray-800 { color: #E0E6EB !important; }
.dark .text-gray-700 { color: #C5CDD6 !important; }
.dark .text-gray-600 { color: #A0ADB8 !important; }
.dark .text-gray-500 { color: #8494A5 !important; }
.dark .text-gray-400 { color: #5E7082 !important; }

/* Borders & dividers */
.dark .border-gray-200 { border-color: #252F3D !important; }
.dark .border-gray-300 { border-color: #324054 !important; }
.dark .divide-gray-100 > * + * { border-color: #252F3D !important; }

/* Hover utilities */
.dark .hover\:bg-gray-50:hover  { background-color: #141A22 !important; }
.dark .hover\:bg-gray-100:hover { background-color: #1A2230 !important; }
.dark .hover\:bg-gray-200:hover { background-color: #252F3D !important; }
.dark .hover\:text-gray-600:hover { color: #A0ADB8 !important; }
.dark .hover\:text-gray-700:hover { color: #C5CDD6 !important; }
.dark .hover\:bg-red-50:hover   { background-color: rgba(239,68,68,0.1) !important; }

/* Form elements */
.dark input,
.dark textarea,
.dark select {
  background-color: #141A22;
  color: #E0E6EB;
  border-color: #324054;
}
.dark input::placeholder,
.dark textarea::placeholder {
  color: #5E7082;
}

/* Status badges — translucent backgrounds for dark surfaces */
.dark .bg-green-100   { background-color: rgba(34,197,94,0.15) !important; }
.dark .bg-red-100      { background-color: rgba(239,68,68,0.15) !important; }
.dark .bg-amber-100    { background-color: rgba(245,158,11,0.15) !important; }
.dark .bg-blue-100     { background-color: rgba(59,130,246,0.15) !important; }
.dark .bg-orange-100   { background-color: rgba(249,115,22,0.15) !important; }
.dark .bg-emerald-100  { background-color: rgba(16,185,129,0.15) !important; }
.dark .bg-brand-100    { background-color: rgba(37,99,235,0.15) !important; }

/* Alert/notice backgrounds */
.dark .bg-green-50  { background-color: rgba(34,197,94,0.1) !important; }
.dark .bg-red-50    { background-color: rgba(239,68,68,0.1) !important; }
.dark .bg-amber-50  { background-color: rgba(245,158,11,0.1) !important; }
.dark .bg-blue-50   { background-color: rgba(59,130,246,0.1) !important; }
.dark .bg-brand-50  { background-color: rgba(37,99,235,0.1) !important; }

/* Alert/notice borders */
.dark .border-green-200  { border-color: rgba(34,197,94,0.3) !important; }
.dark .border-red-200    { border-color: rgba(239,68,68,0.3) !important; }
.dark .border-red-300    { border-color: rgba(239,68,68,0.35) !important; }
.dark .border-amber-200  { border-color: rgba(245,158,11,0.3) !important; }
.dark .border-amber-300  { border-color: rgba(245,158,11,0.35) !important; }
.dark .border-blue-200   { border-color: rgba(59,130,246,0.3) !important; }
.dark .border-brand-200  { border-color: rgba(37,99,235,0.3) !important; }
.dark .border-brand-500  { border-color: rgba(37,99,235,0.6) !important; }

/* Stepper */
.dark .stepper-line         { background: #252F3D; }
.dark .stepper-dot--pending { background: #1A2230; color: #5E7082; border-color: #324054; }
.dark .stepper-label        { color: #8494A5; }

/* Score bar */
.dark .score-bar-track { background: #252F3D; }

/* Card hover */
.dark .card-selectable:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* Drop zone */
.dark .drop-zone.drag-over { border-color: #3b82f6; background-color: rgba(37,99,235,0.1); }

/* Spinner */
.dark .spinner { border-color: #252F3D; border-top-color: #3b82f6; }

/* Modal backdrop — slightly heavier in dark mode */
.dark .bg-black\/50 { background-color: rgba(0,0,0,0.65) !important; }

/* Tab bar active state */
.dark .tab-btn.active { color: #60a5fa; border-bottom-color: #60a5fa; }
.dark .nav-tab.active { color: #60a5fa; }

/* Admin sub-links — dark */
.dark .admin-sub-link.active-sub { background-color: rgba(37,99,235,0.15); color: #60a5fa; }

/* Footer — dark */
.dark footer { background-color: #0B0F14 !important; border-color: #252F3D !important; }

/* Home nav grid — dark */
.dark .home-card { background-color: #141A22 !important; border-color: #252F3D !important; }
.dark .home-card:hover { border-color: #3b82f6 !important; box-shadow: 0 8px 24px rgba(37,99,235,0.15); }
