/* ═══════════════════════════════════════════════════════════════════
   CITIZENS CITY — Game Theme v1
   Shared visual system for all 24+ citizens pages.
   Load AFTER light-mode.css, BEFORE page-specific inline styles.
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --city-bg: #07000f;
  --city-surface: rgba(8, 0, 18, 0.85);
  --city-surface-hover: rgba(15, 2, 30, 0.95);
  --city-border: rgba(0, 200, 255, 0.08);
  --city-border-hover: rgba(0, 200, 255, 0.25);
  --city-border-active: rgba(0, 200, 255, 0.45);
  --city-text: #e0e0e0;
  --city-text-dim: #8a8a9a;
  --city-text-bright: #fff;
  --city-neon-cyan: #0cf;
  --city-neon-green: #2ecc71;
  --city-neon-purple: #9b59b6;
  --city-neon-gold: #fc0;
  --city-neon-orange: #f82;
  --city-neon-red: #f22;
  --city-neon-pink: #ff6b9d;
  --city-glow-cyan: 0 0 20px rgba(0,204,255,0.15);
  --city-glow-green: 0 0 20px rgba(46,204,113,0.15);
  --city-glow-purple: 0 0 20px rgba(155,89,182,0.15);
  --city-glow-gold: 0 0 20px rgba(252,204,0,0.15);
  --city-radius: 12px;
  --city-radius-sm: 8px;
  --city-radius-xs: 5px;
  --city-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --city-font-heading: 'Orbitron', sans-serif;
  --city-font-body: 'Inter', sans-serif;
  --city-font-mono: 'Share Tech Mono', monospace;
}

/* ── Scanline overlay for game feel ───────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  mix-blend-mode: multiply;
}

/* ── Universal smooth transitions ─────────────────────────────── */
a, button, input, textarea, select {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Cards ────────────────────────────────────────────────────── */
.city-card,
.check,
.svc-card,
.item-card,
.entry-card,
.bounty-card,
.room-card,
.ep-card,
.draw-card,
.retired-card,
.truck-card,
.menu-card,
.story-card,
.emb-card,
.seed-card,
.equip-card,
.plot-card,
.listing-card {
  background: var(--city-surface);
  border: 1px solid var(--city-border);
  border-radius: var(--city-radius);
  transition: all var(--city-transition);
  position: relative;
  overflow: hidden;
}

.city-card:hover,
.check:hover,
.svc-card:hover,
.item-card:hover,
.entry-card:hover,
.bounty-card:hover,
.room-card:hover,
.ep-card:hover,
.retired-card:hover,
.menu-card:hover,
.story-card:hover,
.emb-card:hover,
.seed-card:hover,
.equip-card:hover,
.plot-card:hover,
.listing-card:hover {
  border-color: var(--city-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--city-glow-cyan);
}

/* Top-edge neon accent line on card hover */
.city-card::before,
.svc-card::before,
.item-card::before,
.seed-card::before,
.equip-card::before,
.menu-card::before,
.emb-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--city-neon-cyan), transparent);
  opacity: 0;
  transition: opacity var(--city-transition);
}

.city-card:hover::before,
.svc-card:hover::before,
.item-card:hover::before,
.seed-card:hover::before,
.equip-card:hover::before,
.menu-card:hover::before,
.emb-card:hover::before {
  opacity: 0.6;
}

/* ── Buttons ──────────────────────────────────────────────────── */
button, .btn,
input[type="submit"], .modal-btn {
  font-family: var(--city-font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: 1px solid rgba(0, 200, 255, 0.2);
  border-radius: var(--city-radius-sm);
  background: linear-gradient(135deg, rgba(0,204,255,0.08), rgba(155,89,182,0.08));
  color: var(--city-neon-cyan);
  padding: 10px 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--city-transition);
}

button:hover, .btn:hover,
input[type="submit"]:hover, .modal-btn:hover {
  border-color: var(--city-neon-cyan);
  background: linear-gradient(135deg, rgba(0,204,255,0.15), rgba(155,89,182,0.12));
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.2), inset 0 0 15px rgba(0, 204, 255, 0.05);
  transform: translateY(-1px);
  color: #fff;
}

button:active, .btn:active, .modal-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 8px rgba(0, 204, 255, 0.15);
}

button:disabled, .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Primary action buttons (green glow) */
.modal-btn {
  background: linear-gradient(135deg, rgba(46,204,113,0.12), rgba(0,204,255,0.08));
  border-color: rgba(46, 204, 113, 0.3);
  color: var(--city-neon-green);
}

.modal-btn:hover {
  border-color: var(--city-neon-green);
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.2), inset 0 0 15px rgba(46, 204, 113, 0.05);
  color: #fff;
}

/* Danger buttons */
.danger {
  background: linear-gradient(135deg, rgba(255,50,50,0.12), rgba(255,100,50,0.08));
  border-color: rgba(255, 50, 50, 0.3);
  color: var(--city-neon-red);
}

.danger:hover {
  border-color: var(--city-neon-red);
  box-shadow: 0 0 15px rgba(255, 50, 50, 0.2);
  color: #fff;
}

/* ── Inputs ───────────────────────────────────────────────────── */
input[type="text"], input[type="number"], input[type="email"],
textarea, select,
.modal-input, .list-input, .filter-search,
.create-input, .of-input, .lookup-input {
  font-family: var(--city-font-mono);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 200, 255, 0.1);
  border-radius: var(--city-radius-sm);
  color: var(--city-text);
  padding: 10px 14px;
  outline: none;
  transition: all var(--city-transition);
}

input[type="text"]:focus, input[type="number"]:focus,
textarea:focus, select:focus,
.modal-input:focus, .list-input:focus {
  border-color: var(--city-neon-cyan);
  box-shadow: 0 0 12px rgba(0, 204, 255, 0.12);
  background: rgba(0, 0, 0, 0.6);
}

input::placeholder, textarea::placeholder {
  color: rgba(140, 140, 160, 0.5);
}

/* ── Modals ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: linear-gradient(180deg, rgba(12, 2, 24, 0.98), rgba(6, 0, 14, 0.98));
  border: 1px solid rgba(0, 200, 255, 0.12);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 480px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), 0 0 80px rgba(0, 204, 255, 0.03);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #888;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.3) !important;
  background: rgba(255,255,255,0.05) !important;
  transform: none;
  box-shadow: none;
}

.modal-title {
  font-family: var(--city-font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--city-neon-cyan);
  text-align: center;
  margin-bottom: 8px;
}

.modal-sub {
  font-size: 12px;
  color: var(--city-text-dim);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-field { margin-bottom: 14px; }

.modal-label {
  display: block;
  font-family: var(--city-font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--city-text-dim);
  margin-bottom: 6px;
}

.modal-status {
  text-align: center;
  font-size: 12px;
  margin-top: 12px;
  min-height: 18px;
}

.modal-status.success { color: var(--city-neon-green); }
.modal-status.error { color: var(--city-neon-red); }

/* ── Progress Bars ────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.progress-bar > div, .progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--city-neon-cyan), var(--city-neon-green));
  transition: width 0.5s ease;
  position: relative;
}

.progress-bar > div::after, .progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Tables ───────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

th {
  font-family: var(--city-font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--city-text-dim);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--city-border);
  background: rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--city-text);
}

tbody tr:hover { background: rgba(0, 204, 255, 0.03); }

/* ── Hero sections ────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 20px 32px;
}

.hero-tag {
  font-family: var(--city-font-heading);
  font-size: 10px;
  letter-spacing: 5px;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 12px;
}

.hero h1 {
  font-family: var(--city-font-heading);
  font-weight: 900;
  font-size: clamp(22px, 5vw, 38px);
  line-height: 1.2;
  margin-bottom: 14px;
}

.hero-sub {
  font-size: clamp(12px, 2vw, 14px);
  color: var(--city-text-dim);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Back link ────────────────────────────────────────────────── */
.bl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--city-font-mono);
  font-size: 12px;
  color: var(--city-neon-purple);
  text-decoration: none;
  padding: 8px 0;
}

.bl:hover {
  color: var(--city-neon-cyan);
  transform: translateX(-3px);
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 204, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 204, 255, 0.3); }

/* ── Selection ────────────────────────────────────────────────── */
::selection { background: rgba(0, 204, 255, 0.25); color: #fff; }

/* ── Grid systems ─────────────────────────────────────────────── */
.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Pixel art rendering ──────────────────────────────────────── */
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0,204,255,0.2); }
  50% { box-shadow: 0 0 20px rgba(0,204,255,0.4); }
}

@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Live indicator dot */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--city-neon-green);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
  animation: pulse 1.5s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Utility colors ───────────────────────────────────────────── */
.text-green { color: var(--city-neon-green); }
.text-gold { color: var(--city-neon-gold); }
.text-red { color: var(--city-neon-red); }
.text-cyan { color: var(--city-neon-cyan); }
.text-purple { color: var(--city-neon-purple); }
.text-dim { color: var(--city-text-dim); }

/* ── Divider ──────────────────────────────────────────────────── */
.city-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--city-border-hover), transparent);
  margin: 24px 0;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--city-text-dim);
  font-size: 13px;
}

.empty-state::before {
  content: '///';
  display: block;
  font-family: var(--city-font-mono);
  font-size: 28px;
  opacity: 0.15;
  margin-bottom: 12px;
  letter-spacing: 8px;
}

/* ── Mobile responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
  .city-grid { grid-template-columns: 1fr; gap: 12px; }

  .modal-box {
    width: 96%;
    padding: 20px 16px;
    max-height: 90vh;
  }

  .hero { padding: 32px 16px 24px; }
  .hero h1 { font-size: clamp(20px, 6vw, 32px); }

  button, .btn { padding: 9px 14px; font-size: 10px; }
  th, td { padding: 8px; font-size: 11px; }
}

@media (max-width: 400px) {
  .hero { padding: 24px 12px 20px; }
  .modal-box { padding: 16px 12px; border-radius: 12px; }
}

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  body::after { display: none; }
}

/* ── Light mode overrides ─────────────────────────────────────── */
[data-theme="light"] {
  --city-bg: #fafaf8;
  --city-surface: rgba(255, 255, 255, 0.9);
  --city-surface-hover: rgba(255, 255, 255, 0.98);
  --city-border: rgba(0, 0, 0, 0.08);
  --city-border-hover: rgba(79, 70, 229, 0.2);
  --city-text: #1a1a2e;
  --city-text-dim: #666;
  --city-text-bright: #000;
  --city-neon-cyan: #4f46e5;
  --city-neon-green: #16a34a;
  --city-neon-purple: #7c3aed;
}

[data-theme="light"] body::after { display: none; }

[data-theme="light"] .modal-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,246,0.98));
  border-color: rgba(0,0,0,0.1);
}
