/* ═══════════════════════════════════════════════
   Prediction Markets — main.css
   ═══════════════════════════════════════════════ */

:root {
  --bg:           #0a0b0d;
  --bg2:          #111318;
  --bg3:          #191c23;
  --border:       #222530;
  --border-light: #2e3340;
  --text:         #e8eaf0;
  --text-muted:   #6b7280;
  --text-dim:     #9ca3af;
  --accent:       #4ade80;
  --accent-dark:  #16a34a;
  --danger:       #f87171;
  --gold:         #fbbf24;
  --blue:         #60a5fa;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input { font-family: var(--font-body); }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; }
.hidden { display: none !important; }

/* ── AUTH PAGE ── */
.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 50% at 70% 20%, rgba(74,222,128,0.06) 0%, transparent 60%),
    var(--bg);
}
.site-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.logo-icon { color: var(--accent); font-size: 1.3rem; }
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5rem;
  padding: 3rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}
.hero-text { flex: 1; max-width: 420px; }
.hero-text h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}
.hero-text h1 em { font-style: normal; color: var(--accent); }
.hero-text p { font-size: 1.05rem; color: var(--text-dim); line-height: 1.7; }
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text-dim); }

/* ── FIELDS ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input, .inline-form input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.field input:focus, .inline-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.12);
}
.field input::placeholder, .inline-form input::placeholder { color: var(--text-muted); }
.form-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2rem; margin-bottom: 0.75rem; }
.form-note { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: 1rem; }
.site-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── BUTTONS ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--accent);
  color: #0a0b0d;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.5rem;
  white-space: nowrap;
}
.btn-primary.auto-width { width: auto; margin-top: 0; }
.btn-primary:hover { background: #86efac; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--text-dim); color: var(--text); }
.btn-outline.small { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(248,113,113,0.1); }
.btn-approve {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-approve:hover { background: rgba(74,222,128,0.1); }
.btn-spinner { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── APP LAYOUT ── */
.app-page { display: flex; flex-direction: column; min-height: 100vh; }
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,11,13,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
}
.nav-left { display: flex; align-items: center; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-link {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-username { font-size: 0.8rem; color: var(--text-muted); }
.app-main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ── EVENT CARDS ── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.loading-state {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 0;
  color: var(--text-muted);
}
.spinner { font-size: 2rem; color: var(--accent); animation: spin 2s linear infinite; }
.empty-state { text-align: center; padding: 5rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-sub { font-size: 0.85rem; margin-top: 0.4rem; }
.event-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s, transform 0.15s;
}
.event-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.event-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.event-odds { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.odds-side { display: flex; flex-direction: column; gap: 0.2rem; min-width: 80px; }
.odds-side.for { align-items: flex-start; }
.odds-side.against { align-items: flex-end; }
.odds-pct { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.odds-side.for .odds-pct { color: var(--accent); }
.odds-side.against .odds-pct { color: var(--danger); }
.odds-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--text-muted); }
.odds-coeff { font-size: 0.8rem; font-weight: 500; color: var(--text-dim); }
.event-bar { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%); border-radius: 99px; transition: width 0.5s ease; }
.event-actions { display: flex; gap: 0.6rem; }
.vote-btn {
  flex: 1;
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid;
  transition: all 0.15s;
}
.vote-btn.for-btn { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.25); color: var(--accent); }
.vote-btn.for-btn:hover, .vote-btn.for-btn.voted { background: rgba(74,222,128,0.18); border-color: var(--accent); }
.vote-btn.against-btn { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); color: var(--danger); }
.vote-btn.against-btn:hover, .vote-btn.against-btn.voted { background: rgba(248,113,113,0.18); border-color: var(--danger); }
.vote-btn.voted { font-weight: 800; }
.event-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%; max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-muted); font-size: 1rem; padding: 0.3rem; transition: color 0.2s; }
.modal-close:hover { color: var(--text); }
.modal-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.35rem; letter-spacing: -0.02em; }
.modal-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── ADMIN PAGE ── */
.admin-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; margin-bottom: 1.5rem; }
.section-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.35rem; }
.section-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.badge { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 99px; font-family: var(--font-display); letter-spacing: 0.04em; }
.admin-badge { background: rgba(251,191,36,0.15); color: var(--gold); }
.pending-badge { background: rgba(96,165,250,0.15); color: var(--blue); }
.inline-form { display: flex; gap: 0.75rem; align-items: stretch; }
.inline-form input { flex: 1; }
.admin-list { display: flex; flex-direction: column; gap: 0.75rem; }
.list-empty { color: var(--text-muted); font-size: 0.9rem; padding: 0.5rem 0; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); flex-wrap: wrap; }
.admin-row-info { flex: 1; min-width: 200px; }
.admin-row-title { font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; margin-bottom: 0.2rem; }
.admin-row-meta { font-size: 0.75rem; color: var(--text-muted); }
.admin-row-actions { display: flex; gap: 0.5rem; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(4rem);
  background: var(--bg3); border: 1px solid var(--border-light);
  color: var(--text); padding: 0.7rem 1.4rem; border-radius: 99px;
  font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow);
  z-index: 2000; opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease;
  white-space: nowrap; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.success { border-color: rgba(74,222,128,0.4); color: var(--accent); }
#toast.error { border-color: rgba(248,113,113,0.4); color: var(--danger); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .auth-main { flex-direction: column; gap: 2rem; padding-top: 2rem; }
  .hero-text h1 { font-size: 2rem; }
  .app-nav { padding: 0.85rem 1rem; }
  .nav-username { display: none; }
  .app-main { padding: 1.5rem 1rem; }
  .page-header { flex-direction: column; }
  .events-grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}
