@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Oswald:wght@500;600;700&display=swap');

:root {
  --primary: #D4851F;
  --primary-dark: #B5701A;
  --primary-light: #F5A623;
  --gold: #F5C542;
  --bg: #FFFFFF;
  --card-bg: #F7F7F7;
  --card-bg-hover: #F0F0F0;
  --text: #111111;
  --text-secondary: #555555;
  --text-muted: #888888;
  --divider: #E5E5E5;
  --success: #2D8B4E;
  --danger: #C0392B;
  --warning: #E67E22;
  --info: #2980B9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-display: 'Oswald', sans-serif;
  --transition: 0.2s ease;
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════ HEADER ═══════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.header-logo img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.header-logo h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}

.header-logo h1 span {
  color: var(--primary);
}

/* Responsive header sizing */
@media (max-width: 374px) {
  .header-logo img { width: 48px; height: 48px; }
  .header-logo h1 { font-size: 0.95rem; }
  .header-logo { gap: 8px; }
}

@media (min-width: 375px) and (max-width: 767px) {
  .header-logo img { width: 56px; height: 56px; }
  .header-logo h1 { font-size: 1.15rem; }
}

@media (min-width: 768px) {
  .side-nav .nav-header img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.header-btn:hover { background: var(--divider); }
.header-btn.active { background: var(--primary); color: #fff; }

/* ═══════════════════════ BOTTOM NAV ═══════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-top: 1px solid var(--divider);
  display: flex;
  height: 72px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  position: relative;
}

.nav-item svg { width: 26px; height: 26px; }
.nav-item.active { color: var(--primary); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 32px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ═══════════════════════ PAGE CONTAINER ═══════════════════════ */
.page { display: none; padding: 20px; max-width: 900px; margin: 0 auto; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  color: var(--text);
}

.page-title span { color: var(--primary); }

/* ═══════════════════════ CARDS ═══════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
}

/* ═══════════════════════ LIVE SCORE CARD ═══════════════════════ */
.score-card { position: relative; overflow: hidden; }
.score-card.live { border-left: 4px solid var(--danger); }
.score-card.live .card-label { color: var(--danger); }
.score-card.final .card-label { color: var(--success); }

.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-pulse::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

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

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.score-row + .score-row { border-top: 1px solid var(--divider); }

.team-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-color {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: #fff;
}

.team-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.team-name.winner { font-weight: 800; }

.score-num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  min-width: 60px;
  text-align: right;
}

.score-num.winner { color: var(--primary); }

.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.game-clock {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

/* ═══════════════════════ BUTTONS ═══════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary { background: var(--card-bg); color: var(--text); border: 2px solid var(--divider); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

.btn-sm { height: 40px; padding: 0 18px; font-size: 0.78rem; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-xs); }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════ FORMS ═══════════════════════ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 2px solid var(--divider);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 133, 31, 0.15);
}

.form-textarea { height: 120px; padding: 14px 16px; resize: vertical; }
.form-select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-error { color: var(--danger); font-size: 0.78rem; margin-top: 4px; }

/* ═══════════════════════ TABLES ═══════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.data-table th {
  background: var(--card-bg);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 12px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

.data-table tr:hover td { background: rgba(212, 133, 31, 0.04); }

/* ═══════════════════════ TABS ═══════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--divider);
}

.tab {
  padding: 10px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* ═══════════════════════ BADGES ═══════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-live { background: rgba(192, 57, 43, 0.1); color: var(--danger); }
.badge-final { background: rgba(45, 139, 78, 0.1); color: var(--success); }
.badge-upcoming { background: rgba(41, 128, 185, 0.1); color: var(--info); }
.badge-pending { background: rgba(230, 126, 34, 0.1); color: var(--warning); }
.badge-approved { background: rgba(45, 139, 78, 0.1); color: var(--success); }

/* ═══════════════════════ MODAL ═══════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 20px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════ SCOREKEEPER ═══════════════════════ */
.sk-team-section { margin-bottom: 28px; }
.sk-team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  margin-bottom: 10px;
}

.sk-team-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sk-team-score {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.sk-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  gap: 8px;
}

.sk-player-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 80px;
}

.sk-stat-btns { display: flex; gap: 6px; }

.sk-stat-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  border: 2px solid var(--divider);
  background: var(--bg);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.sk-stat-btn:hover { border-color: var(--primary); }
.sk-stat-btn .stat-val {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
}
.sk-stat-btn .stat-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1;
}

.sk-stat-btn.danger-zone { border-color: rgba(192,57,43,0.3); }
.sk-stat-btn.danger-zone .stat-val { color: var(--danger); }

.sk-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.quarter-display {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  padding: 10px;
}

/* ═══════════════════════ TEAM PAGE ═══════════════════════ */
.team-banner {
  border-radius: var(--radius);
  padding: 30px 22px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.team-banner::after {
  content: '🏀';
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 100px;
  opacity: 0.15;
}

.team-banner h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.team-record {
  font-size: 1rem;
  opacity: 0.9;
  margin-top: 6px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.player-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.player-number {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.player-details h4 { font-weight: 700; font-size: 1rem; }
.player-details p { font-size: 0.78rem; color: var(--text-secondary); }

.player-stats {
  margin-left: auto;
  display: flex;
  gap: 14px;
  text-align: center;
}

.player-stats .stat-item { display: flex; flex-direction: column; }
.player-stats .stat-val { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.player-stats .stat-label { font-size: 0.55rem; text-transform: uppercase; color: var(--text-muted); }

/* ═══════════════════════ ANNOUNCEMENTS ═══════════════════════ */
.announcement-card {
  padding: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 14px;
  border-left: 4px solid var(--primary);
}

.announcement-card h3 {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.announcement-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.announcement-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ═══════════════════════ DOCUMENTS ═══════════════════════ */
.doc-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.doc-card:hover { box-shadow: var(--shadow-md); }

.doc-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  background: rgba(212, 133, 31, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.doc-info h4 { font-weight: 700; font-size: 0.95rem; }
.doc-info p { font-size: 0.72rem; color: var(--text-muted); }

/* ═══════════════════════ REGISTRATION ═══════════════════════ */
.reg-success {
  text-align: center;
  padding: 40px 20px;
}

.reg-success .icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ═══════════════════════ ADMIN ═══════════════════════ */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.admin-stat-card .stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.admin-stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.admin-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
}

.admin-nav-item:hover { border-color: var(--primary); }
.admin-nav-item .nav-icon { font-size: 1.3rem; }
.admin-nav-item .nav-arrow { margin-left: auto; color: var(--text-muted); }

/* ═══════════════════════ AUTH ═══════════════════════ */
.auth-page {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.auth-page img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 24px;
}

.auth-form {
  width: 100%;
  max-width: 360px;
  text-align: left;
}

/* ═══════════════════════ EMPTY STATE ═══════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* ═══════════════════════ TOAST ═══════════════════════ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ═══════════════════════ UTILITIES ═══════════════════════ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-sm { margin-bottom: 10px; }
.mb-md { margin-bottom: 20px; }
.mb-lg { margin-bottom: 32px; }
.mt-md { margin-top: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 10px; }
.gap-sm { gap: 8px; }
.hidden { display: none !important; }

.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ═══════════════════════ DESKTOP ═══════════════════════ */
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; padding-left: 240px; }

  .side-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--divider);
    padding: 20px 0;
    z-index: 101;
  }

  .side-nav .nav-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--divider);
  }

  .side-nav .nav-header img { width: 40px; height: 40px; border-radius: 50%; }
  .side-nav .nav-header h2 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
  }

  .side-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }

  .side-nav-item:hover { color: var(--text); background: rgba(0,0,0,0.03); }
  .side-nav-item.active { color: var(--primary); background: rgba(212, 133, 31, 0.08); border-right: 3px solid var(--primary); }
  .side-nav-item svg { width: 22px; height: 22px; }

  .page { padding: 28px 40px; max-width: 1100px; }
  .app-header { display: none; }
  .modal { border-radius: var(--radius); max-height: 80vh; }
  .modal-overlay { align-items: center; }
  .admin-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 767px) {
  .side-nav { display: none; }
}

/* ═══════════════════════ SEARCH ═══════════════════════ */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border: 2px solid var(--divider);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--card-bg);
}

.search-bar input:focus { border-color: var(--primary); outline: none; }
.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

/* Standings specific */
.standings-pos {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  min-width: 28px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════ AI COMPONENTS ═══════════════════════ */

/* AI Result Container */
.ai-result {
  background: linear-gradient(135deg, #FFF9F0 0%, #FFF5E6 100%);
  border: 1px solid rgba(212, 133, 31, 0.2);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 16px;
  position: relative;
  line-height: 1.7;
  font-size: 0.92rem;
}

.ai-result::before {
  content: '✨ AI Generated';
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
}

.ai-result p { margin-bottom: 12px; }
.ai-result p:last-child { margin-bottom: 0; }

/* AI Button */
.btn-ai {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 133, 31, 0.35);
}

.btn-ai::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer 2.5s infinite;
}

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

/* AI Loading */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.ai-loading .dots {
  display: flex;
  gap: 4px;
}

.ai-loading .dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotBounce 1.2s infinite;
}

.ai-loading .dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* AI Announce Assist */
.ai-assist-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #FFF9F0 0%, #FFF5E6 100%);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 133, 31, 0.15);
}

.ai-assist-bar .label {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 4px;
}

.ai-chip {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1.5px solid rgba(212, 133, 31, 0.3);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.ai-chip:hover {
  border-color: var(--primary);
  background: rgba(212, 133, 31, 0.08);
  color: var(--primary);
}

/* ═══════════════════════ CHAT WIDGET ═══════════════════════ */
.chat-fab {
  position: fixed;
  bottom: 88px;
  right: 20px;
  z-index: 150;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(212, 133, 31, 0.4);
  transition: var(--transition);
}

.chat-fab:hover { transform: scale(1.08); }

.chat-fab .unread {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

.chat-panel {
  position: fixed;
  bottom: 72px;
  right: 0;
  z-index: 200;
  width: 100%;
  max-width: 420px;
  height: 65vh;
  max-height: 560px;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.chat-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-panel-header h3 .ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--card-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 6px;
}

.chat-msg.typing .dots {
  display: inline-flex;
  gap: 3px;
}

.chat-msg.typing .dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dotBounce 1.2s infinite;
}

.chat-msg.typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg.typing .dots span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
  background: var(--bg);
}

.chat-input-row input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 2px solid var(--divider);
  border-radius: 22px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--card-bg);
}

.chat-input-row input:focus { border-color: var(--primary); outline: none; }

.chat-input-row button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-input-row button:hover { background: var(--primary-dark); }
.chat-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.chat-suggestion-chip {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1.5px solid var(--divider);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.chat-suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Schedule builder specific */
.schedule-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .schedule-options { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .chat-fab { bottom: 24px; right: 24px; }
  .chat-panel { bottom: 0; right: 16px; border-radius: var(--radius) var(--radius) 0 0; height: 70vh; max-height: 600px; }
}

/* ═══════════════════════ SCORING POPUP ═══════════════════════ */
.score-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.score-popup {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  width: 90%;
  max-width: 340px;
  animation: slideUp 0.2s ease;
}

.score-popup h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 18px;
}

.score-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.score-popup-btn {
  height: 64px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--divider);
  background: var(--bg);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.score-popup-btn:active { transform: scale(0.95); }
.score-popup-btn .popup-label { font-family: var(--font-body); font-size: 0.6rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.score-popup-btn.ft { border-color: var(--info); color: var(--info); }
.score-popup-btn.ft:hover { background: rgba(41,128,185,0.08); }
.score-popup-btn.twopt { border-color: var(--success); color: var(--success); }
.score-popup-btn.twopt:hover { background: rgba(45,139,78,0.08); }
.score-popup-btn.threept { border-color: var(--primary); color: var(--primary); }
.score-popup-btn.threept:hover { background: rgba(212,133,31,0.08); }
.score-popup-btn.undo-btn { border-color: var(--danger); color: var(--danger); }
.score-popup-btn.undo-btn:hover { background: rgba(192,57,43,0.08); }

.score-popup-cancel {
  width: 100%;
  padding: 12px;
  border: none;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* ═══════════════════════ ENHANCED SCOREKEEPER ═══════════════════════ */
.sk-stat-btn.has-minus { position: relative; }
.sk-stat-btn .minus-zone {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}

.sk-stat-btn:hover .minus-zone,
.sk-stat-btn:focus .minus-zone { opacity: 1; }

/* Foul warnings */
.sk-stat-btn.foul-warning { border-color: var(--warning) !important; background: rgba(230,126,34,0.08); }
.sk-stat-btn.foul-warning .stat-val { color: var(--warning); }
.sk-stat-btn.fouled-out { border-color: var(--danger) !important; background: rgba(192,57,43,0.12); }
.sk-stat-btn.fouled-out .stat-val { color: var(--danger); }

.sk-player-row.fouled-out-row { opacity: 0.5; background: rgba(192,57,43,0.04); }
.sk-player-row.fouled-out-row::after {
  content: 'FOULED OUT';
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: 1px;
  margin-left: auto;
  padding-right: 4px;
}

/* Clock editor */
.game-clock-display {
  text-align: center;
  padding: 16px 0;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: background 0.3s ease;
}

.game-clock-display.clock-running {
  background: linear-gradient(135deg, #1a1a1a 0%, #2C3E50 100%);
}

.game-clock-display.clock-running .clock-digits {
  color: #4ADE80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.clock-digits {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
  display: block;
  transition: color 0.3s ease;
}

.clock-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.clock-start-btn {
  min-width: 100px;
}

.clock-input {
  width: 50px;
  height: 44px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  border: 2px solid var(--divider);
  border-radius: var(--radius-xs);
  background: var(--bg);
}

.clock-input:focus { border-color: var(--primary); outline: none; }
.clock-sep { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }

/* Period display */
.quarter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--card-bg);
  border-radius: 20px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.quarter-badge.ot { color: var(--danger); }

/* Stat correction inline */
.stat-edit-input {
  width: 44px;
  height: 32px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: var(--radius-xs);
  background: var(--bg);
}

/* Approve & create player */
.reg-action-form {
  margin-top: 12px;
  padding: 14px;
  background: rgba(45,139,78,0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(45,139,78,0.2);
}

.reg-action-form .form-group { margin-bottom: 10px; }
.reg-action-form .form-input,
.reg-action-form .form-select { height: 40px; font-size: 0.8rem; }

.duplicate-warning {
  padding: 10px 14px;
  background: rgba(230,126,34,0.1);
  border: 1px solid rgba(230,126,34,0.3);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  color: var(--warning);
  margin-bottom: 12px;
}

/* Edit inline controls */
.edit-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.edit-inline .form-input {
  height: 36px;
  font-size: 0.8rem;
  padding: 0 10px;
}

/* ═══════════════════════ MORE MENU ═══════════════════════ */
.more-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.more-menu-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.more-menu-item:active { transform: scale(0.99); }

.more-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  background: rgba(212, 133, 31, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}

.more-icon svg { width: 22px; height: 22px; }

.more-info { flex: 1; }
.more-info strong { font-size: 1rem; display: block; margin-bottom: 2px; }
.more-info p { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

.more-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}
