/* NON CRAP League — stylesheet */

:root {
  --green:       #1a7a4a;
  --green-dark:  #145c37;
  --green-light: #e8f5ee;
  --gold:        #c9a84c;
  --text:        #1a1a1a;
  --text-muted:  #6b7280;
  --border:      #d1d5db;
  --bg:          #f9fafb;
  --white:       #ffffff;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg:   0 10px 25px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth page ──────────────────────────────────────────────────────────── */

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo-img {
  width: 180px;
  height: auto;
  display: block;
  margin: 0 auto 0.5rem;
}
.auth-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.motto {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  background: var(--green);
  color: var(--white);
  width: 100%;
}
button:hover:not(:disabled), .btn:hover { background: var(--green-dark); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-sm     { padding: 0.35rem 0.75rem; font-size: 0.8rem; width: auto; }
.btn-ghost  { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-ghost:hover { background: var(--green-light); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }

.error {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  background: var(--red-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

/* ── App shell ──────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
}
.topbar-logo {
  height: 32px;
  width: auto;
}
.topbar-nav { display: flex; gap: 0.25rem; }
.topbar-nav a {
  color: rgba(255,255,255,0.85);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.topbar-nav a:hover, .topbar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  text-decoration: none;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}
.topbar-user button {
  width: auto;
  background: rgba(255,255,255,0.15);
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
}
.topbar-user button:hover { background: rgba(255,255,255,0.25); }

.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ── Cards & panels ─────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

/* ── Leaderboard ────────────────────────────────────────────────────────── */

.leaderboard {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
}
.leaderboard td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard tr:hover td { background: var(--green-light); }

.rank-1 .rank-num { color: var(--gold); font-weight: 800; font-size: 1.1rem; }
.rank-2 .rank-num { color: #9ca3af; font-weight: 700; }
.rank-3 .rank-num { color: #b45309; font-weight: 700; }

.points-big {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green);
}

/* ── Round table ────────────────────────────────────────────────────────── */

.round-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.round-table th {
  background: var(--green);
  color: var(--white);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.round-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.round-table tr:last-child td { border-bottom: none; }
.round-table tr:hover td { background: var(--green-light); }

.score-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.score-pill.correct   { background: #dcfce7; color: #166534; }
.score-pill.incorrect { background: #f3f4f6; color: var(--text-muted); }
.score-pill.partial   { background: #fef9c3; color: #854d0e; }
.score-pill.voided    { background: var(--red-light); color: var(--red); }

/* Score explanation tooltip trigger */
.explanation-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  display: block;
  margin-top: 0.1rem;
}

/* ── Tier badges ────────────────────────────────────────────────────────── */

.tier-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tier-fulltime  { background: #dbeafe; color: #1d4ed8; }
.tier-parttime  { background: #ede9fe; color: #6d28d9; }
.tier-panel     { background: #fef3c7; color: #92400e; }
.tier-other     { background: #f3f4f6; color: #374151; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  background: none;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
  width: auto;
}
.tab-btn:hover { color: var(--green); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Misc ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--green-light);
  color: var(--green);
}
.badge-gold { background: #fef3c7; color: #92400e; }

[x-cloak] { display: none !important; }

.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state p { margin-top: 0.5rem; font-size: 0.9rem; }

/* ── Typeahead ──────────────────────────────────────────────────────────── */

.typeahead-wrap {
  position: relative;
}
.typeahead-wrap input {
  width: 100%;
}
.typeahead-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
}
.typeahead-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item:hover,
.typeahead-item.focused { background: var(--green-light); }
.typeahead-item.suggest {
  color: var(--green);
  font-style: italic;
  font-size: 0.85rem;
}
.typeahead-item.suggest:hover { background: var(--green-light); }
.pts-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.pts-label.pts-1 { color: #1d4ed8; }
.pts-label.pts-2 { color: #6d28d9; }
.pts-label.pts-3 { color: #92400e; }
.pts-label.pts-4 { color: #374151; }

/* ── Intel feed ─────────────────────────────────────────────────────────── */

.intel-item {
  border-left: 3px solid var(--green);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  background: var(--white);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.875rem;
}
.intel-item.has-clash {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
.intel-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.clash-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-top: 0.4rem;
  color: #78350f;
}
.clash-warning .icon { flex-shrink: 0; font-style: normal; }

/* ── Prediction entry grid ──────────────────────────────────────────────── */

.fixture-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.fixture-header {
  background: var(--green);
  color: var(--white);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
}
.fixture-header strong { font-size: 0.95rem; }
.fixture-body { padding: 0.75rem 1rem 1rem; }
.role-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.role-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Notification inbox badge ───────────────────────────────────────────── */

.inbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--red);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
  margin-left: 4px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .main-content { padding: 1rem 0.75rem; }
  .topbar-nav { display: none; }
  .round-table { font-size: 0.8rem; }
  .round-table th, .round-table td { padding: 0.4rem 0.5rem; }
}
