/* ──────────────────────────────────────────────────────────────────────────
   F1 Picks — Global Stylesheet
   Mobile-first, dark-mode aware, Bootstrap 5 extensions
   ────────────────────────────────────────────────────────────────────────── */

/* ── Rounds table closed filter ────────────────────────────────────────── */
#rounds_table_wrap.hide-closed tr.row-closed { display: none !important; }
#rounds_table_wrap.hide-closed tr.row-closed.row-latest-closed { display: table-row !important; }
#rounds_cards_wrap.hide-closed .row-closed { display: none !important; }
#rounds_cards_wrap.hide-closed .row-closed.row-latest-closed { display: block !important; }

/* ── F1 brand colors ────────────────────────────────────────────────────── */
.btn-f1 {
  background-color: #e10600;
  border-color: #e10600;
  color: white;
}
.btn-f1:hover {
  background-color: #c40500;
  border-color: #c40500;
  color: white;
}
.btn-f1:focus, .btn-f1.focus {
  box-shadow: 0 0 0 0.2rem rgba(225, 6, 0, 0.25);
}
.btn-f1:disabled, .btn-f1.disabled {
  background-color: #e10600;
  border-color: #e10600;
  opacity: 0.65;
}

/* ── Admin layout improvements ──────────────────────────────────────────── */
.admin-card-icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background-color: rgba(255,255,255,0.2);
  border-radius: 50%;
  margin-right: 0.5rem;
}
.admin-section { margin-bottom: 2rem; }
.admin-section:last-child { margin-bottom: 0; }

/* ── Admin predictions page ─────────────────────────────────────────────── */
.admin-predictions .card-header {
  background-color: var(--bs-primary);
  color: white;
  border-bottom: none;
}
.admin-predictions .card-header .h6 { margin-bottom: 0; }
.admin-predictions .form-select:disabled {
  background-color: var(--bs-gray-100);
  opacity: 0.7;
}
.admin-predictions .alert-secondary {
  border-left: 4px solid var(--bs-primary);
}
.admin-predictions .badge { font-size: 0.75em; }
.admin-predictions .card { transition: box-shadow 0.15s ease-in-out; }
.admin-predictions .card:hover { box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15); }


/* ──────────────────────────────────────────────────────────────────────────
   RESPONSIVE TABLE → CARD CONVERSION
   On mobile, stacked tables can be rendered as cards for readability
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  /* Card-style score rows on mobile */
  .score-table-card-mode table { display: block; }
  .score-table-card-mode thead { display: none; }
  .score-table-card-mode tbody { display: block; }
  .score-table-card-mode tr {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    gap: 6px;
  }
  .score-table-card-mode td {
    display: block;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  .score-table-card-mode td[data-label]:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-right: 4px;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   GENERAL MOBILE IMPROVEMENTS
   ────────────────────────────────────────────────────────────────────────── */

/* Ensure cards have good touch targets */
.card { border-radius: 12px; }

/* Better tap targets on mobile */
@media (max-width: 767.98px) {
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 44px; }

  /* Typography scale down on mobile */
  h1 { font-size: 1.6rem !important; }
  h2 { font-size: 1.4rem !important; }
  h3 { font-size: 1.2rem !important; }

  /* Give containers a little more breathing room */
  .container.my-4 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
}

/* Score cells in leaderboard tables */
.score-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────────────────────
   SEASON STANDINGS MOBILE IMPROVEMENTS
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  /* Make season table scroll horizontally smoothly */
  .season-standings-table {
    font-size: 0.85rem;
  }
  .season-standings-table th,
  .season-standings-table td {
    padding: 0.4rem 0.5rem !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   PREDICTION PAGE IMPROVEMENTS
   ────────────────────────────────────────────────────────────────────────── */
.prediction-section {
  border-radius: 12px;
  overflow: hidden;
}

/* Select2 dark mode compatibility */
[data-theme="dark"] .select2-container--default .select2-selection--single {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .select2-dropdown {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}
[data-theme="dark"] .select2-results__option {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .select2-results__option--highlighted {
  background-color: #e10600 !important;
  color: white !important;
}
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ──────────────────────────────────────────────────────────────────────────
   HOMEPAGE IMPROVEMENTS
   ────────────────────────────────────────────────────────────────────────── */
.hero-card {
  background: linear-gradient(135deg, #15151e 0%, #1a1a2e 100%);
  color: white;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 200px; height: 100%;
  background: linear-gradient(135deg, transparent, rgba(225,6,0,0.2));
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   GAMES PAGE MOBILE IMPROVEMENTS
   ────────────────────────────────────────────────────────────────────────── */
.game-card {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.game-card:active { transform: scale(0.98); }

/* ──────────────────────────────────────────────────────────────────────────
   BONUS BADGES
   ────────────────────────────────────────────────────────────────────────── */
.bonus-badge {
  display: inline-block;
  width: 20px; height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  font-size: 11px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}
.bonus-exact { background: #28a745; color: white; }
.bonus-beat  { background: #dc3545; color: white; }

/* ──────────────────────────────────────────────────────────────────────────
   DARK MODE FIXES
   ────────────────────────────────────────────────────────────────────────── */
[data-theme="dark"] .list-group-item {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .list-group-item-action:hover {
  background: var(--bg-primary) !important;
}

/* ──────────────────────────────────────────────────────────────────────────
   SCROLL TO TOP BUTTON
   ────────────────────────────────────────────────────────────────────────── */
#scrollTopBtn {
  position: fixed;
  bottom: 76px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #e10600;
  color: white;
  border: none;
  display: none;
  align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  z-index: 1039;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: opacity 0.2s;
}
#scrollTopBtn:hover { background: #c40500; }
@media (min-width: 992px) {
  #scrollTopBtn { bottom: 20px; }
}
