/* AllFitness — dark neon theme (Tailwind-inspired utilities) */
:root {
  --bg: #0a0a0c;
  --bg-card: #121218;
  --bg-elevated: #1a1a24;
  --border: #2a2a3a;
  --text: #f0f0f5;
  --muted: #9a9ab0;
  --neon-red: #ff2d55;
  --neon-green: #39ff14;
  --neon-orange: #ff9f0a;
  --neon-purple: #bf5af2;
  --neon-cyan: #64d2ff;
  --neon-pink: #ff375f;
  --danger: #ff2d55;
  --success: #39ff14;
  --radius: 1rem;
  --glow-red: 0 0 12px rgba(255, 45, 85, 0.55);
  --glow-green: 0 0 12px rgba(57, 255, 20, 0.45);
  --glow-purple: 0 0 12px rgba(191, 90, 242, 0.45);
  --glow-orange: 0 0 12px rgba(255, 159, 10, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--neon-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }
input, select, textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--neon-green);
  box-shadow: 0 0 0 2px rgba(57, 255, 20, 0.2);
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }

/* Layout */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  background: rgba(10, 10, 12, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--neon-green);
  text-shadow: var(--glow-green);
  margin-right: 0.75rem;
  font-size: 1.05rem;
}
.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: 0.15s;
}
.nav-btn:hover { color: var(--text); border-color: var(--border); }
.nav-btn.active {
  color: var(--bg);
  background: var(--neon-green);
  box-shadow: var(--glow-green);
  border-color: var(--neon-green);
  font-weight: 700;
}
.nav-user {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.main {
  flex: 1;
  padding: 1rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
.footer {
  text-align: center;
  padding: 1.25rem;
  color: #fff;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { color: var(--neon-green); }

/* Bento */
.bento {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .bento-2 { grid-template-columns: 1fr 1fr; }
  .bento-3 { grid-template-columns: repeat(3, 1fr); }
  .bento-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .bento-4 { grid-template-columns: repeat(4, 1fr); }
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02) inset;
  min-width: 0;
}
.card h2, .card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--neon-cyan);
  letter-spacing: 0.02em;
}
.card-scroll {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  background: #0d0d12;
  border-radius: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  font-weight: 700;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none !important; }
.btn-green {
  background: var(--neon-green);
  color: #041004;
  box-shadow: var(--glow-green);
}
.btn-red {
  background: var(--neon-red);
  color: #fff;
  box-shadow: var(--glow-red);
}
.btn-orange {
  background: var(--neon-orange);
  color: #1a0e00;
  box-shadow: var(--glow-orange);
}
.btn-purple {
  background: var(--neon-purple);
  color: #fff;
  box-shadow: var(--glow-purple);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }

/* Forms */
.form-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr 1fr; }
}
.field { min-width: 0; }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.stack { display: flex; flex-direction: column; gap: 0.75rem; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(57, 255, 20, 0.08), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 45, 85, 0.1), transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  box-shadow: var(--glow-green);
}
.login-card h1 {
  margin: 0 0 0.25rem;
  text-align: center;
  color: var(--neon-green);
  text-shadow: var(--glow-green);
}
.login-card .sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error {
  background: rgba(255, 45, 85, 0.12);
  border: 1px solid var(--neon-red);
  color: #ff8da1;
  box-shadow: var(--glow-red);
}
.alert-ok {
  background: rgba(57, 255, 20, 0.1);
  border: 1px solid var(--neon-green);
  color: #b6ffaa;
}

/* Tabs content */
.tab { display: none; }
.tab.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Modal overlay */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 2px solid var(--border);
  max-width: 480px;
  width: 100%;
  padding: 1.25rem;
  max-height: 90vh;
  overflow: auto;
}
.modal.modal-green {
  border-color: var(--neon-green);
  box-shadow: var(--glow-green);
}
.modal.modal-red {
  border-color: var(--neon-red);
  box-shadow: var(--glow-red);
}
.modal-photo {
  width: 140px;
  height: 140px;
  border-radius: 1rem;
  object-fit: cover;
  margin: 0.75rem auto;
  border: 2px solid var(--border);
  background: #000;
}
.modal h3 { margin: 0; text-align: center; }
.modal .meta { text-align: center; color: var(--muted); font-size: 0.9rem; }

/* Tables / lists */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.25rem;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }

.grid-cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.person-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.person-card img {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border);
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge-green { background: rgba(57,255,20,0.15); color: var(--neon-green); border: 1px solid var(--neon-green); }
.badge-red { background: rgba(255,45,85,0.15); color: var(--neon-red); border: 1px solid var(--neon-red); }

/* Keypad kiosk */
.kiosk-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(57,255,20,0.07), transparent 50%),
    var(--bg);
}
.kiosk-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--neon-green);
  text-shadow: var(--glow-green);
  margin-bottom: 0.5rem;
  text-align: center;
}
.keypad-display {
  font-size: 2rem;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 1rem;
  min-height: 3.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  width: min(320px, 100%);
  margin-bottom: 1rem;
  background: var(--bg-card);
  font-variant-numeric: tabular-nums;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  width: min(320px, 100%);
}
.key {
  aspect-ratio: 1.4;
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
.key:active { background: var(--bg-elevated); }
.key-go {
  background: var(--neon-green);
  color: #041004;
  box-shadow: var(--glow-green);
  border-color: var(--neon-green);
}
.key-del { color: var(--neon-red); }

/* Video capture */
.video-box {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.preview-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: #000;
}

.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.w-full { width: 100%; }

/* Segmented control */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.seg button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}
.seg button.active {
  border-color: var(--neon-orange);
  color: var(--neon-orange);
  box-shadow: var(--glow-orange);
}

/* Edit modal large */
.modal-lg { max-width: 720px; }

/* Theme editor */
#themeFields input[type="color"] {
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  min-width: 56px;
}
#themeFields code,
.card code {
  font-size: 0.8em;
  color: var(--neon-cyan);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 8px; }
