/* ══════════════════════════════════════════════════════════
   Away We Go Podcast - F1 Prediction Tracker 2026
   ══════════════════════════════════════════════════════════ */

:root {
  --f1-red: #E4002B;
  --f1-dark: #1a1a2e;
  --f1-darker: #111122;
  --f1-card: #222240;
  --f1-card-hover: #2a2a50;
  --f1-accent: #E4002B;
  --f1-text: #f0f0f0;
  --f1-text-dim: #a0a0b8;
  --f1-border: #333355;
  --f1-success: #00c853;
  --f1-warning: #ff9100;
  --f1-gold: #FFD700;
  --f1-silver: #C0C0C0;
  --f1-bronze: #CD7F32;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  background: var(--f1-dark);
  color: var(--f1-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  font-size: 18px;
}

/* ── Header ── */

.header {
  background: var(--f1-darker);
  border-bottom: 3px solid var(--f1-red);
  padding: 1rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-admin {
  border-bottom-color: var(--f1-warning);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  background: var(--f1-red);
  color: white;
  font-weight: 900;
  font-size: 1.8rem;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  letter-spacing: -0.5px;
}

.brand-logo {
  height: 50px;
  width: auto;
  display: block;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 1rem;
  color: var(--f1-text-dim);
  font-weight: 400;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}

.user-name {
  color: var(--f1-text);
  font-weight: 500;
}

/* ── Navigation ── */

.nav {
  display: flex;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--f1-text-dim);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.nav-btn:hover {
  color: var(--f1-text);
}

.nav-btn.active {
  color: var(--f1-text);
  border-bottom-color: var(--f1-red);
}

/* ── Main Content ── */

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

/* ── Calendar + Sidebar Layout ── */

.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.calendar-main {
  min-width: 0;
}

.calendar-sidebar {
  position: sticky;
  top: 100px;
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  padding: 1.2rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--f1-text);
}

.sidebar-leaderboard {
  list-style: none;
  margin-bottom: 1rem;
}

.sidebar-leaderboard li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--f1-border);
  font-size: 1rem;
}

.sidebar-leaderboard li:last-child {
  border-bottom: none;
}

.sidebar-rank {
  min-width: 30px;
  font-weight: 700;
  text-align: center;
}

.sidebar-username {
  flex: 1;
  padding: 0 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-points {
  font-weight: 700;
  color: var(--f1-gold);
  min-width: 50px;
  text-align: right;
}

@media (max-width: 900px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  
  .calendar-sidebar {
    position: static;
    max-height: none;
  }
}

.view-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ── Modal ── */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
   padding-top: 80px;
}

.modal-content {
  background: var(--f1-card);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-content h2 {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
}

.modal-content p {
  color: var(--f1-text-dim);
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

/* ── Forms ── */

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--f1-text);
}

.label-hint {
  color: var(--f1-text-dim);
  font-weight: 400;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--f1-darker);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  color: var(--f1-text);
  font-size: 1.1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--f1-red);
}

.select-full {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--f1-darker);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  color: var(--f1-text);
  font-size: 1.1rem;
  font-family: inherit;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--f1-text-dim);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--f1-red);
}

.error-msg {
  background: rgba(228, 0, 43, 0.15);
  border: 1px solid var(--f1-red);
  color: #ff6b6b;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.success-msg {
  background: rgba(0, 200, 83, 0.15);
  border: 1px solid var(--f1-success);
  color: var(--f1-success);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--f1-red);
  color: white;
}

.btn-primary:hover {
  background: #c9002a;
}

.btn-primary:disabled {
  background: #555;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--f1-border);
  color: var(--f1-text);
}

.btn-secondary:hover {
  background: #444466;
}

.btn-success {
  background: var(--f1-success);
  color: #111;
}

.btn-back {
  background: none;
  color: var(--f1-text-dim);
  padding: 0.4rem 0;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.btn-back:hover {
  color: var(--f1-text);
}

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.95rem;
}

/* ── Race Calendar ── */

.race-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.race-card {
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.race-card:hover {
  background: var(--f1-card-hover);
  border-color: var(--f1-red);
}

.race-card.completed {
  border-left: 3px solid var(--f1-success);
}

.race-card.active {
  border-left: 3px solid var(--f1-red);
  background: var(--f1-card-hover);
}

.race-card.upcoming {
  border-left: 3px solid var(--f1-border);
}

.race-number {
  font-size: 1rem;
  font-weight: 700;
  color: var(--f1-text-dim);
  min-width: 28px;
  text-align: center;
}

.race-flag {
  font-size: 2rem;
  line-height: 1;
}

.race-info {
  flex: 1;
  min-width: 0;
}

.race-name {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.race-meta {
  font-size: 1rem;
  color: var(--f1-text-dim);
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.sprint-badge {
  background: var(--f1-warning);
  color: #111;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.race-status {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: right;
  min-width: 90px;
}

.status-open { color: var(--f1-success); }
.status-locked { color: var(--f1-warning); }
.status-completed { color: var(--f1-text-dim); }

.predicted-badge {
  display: inline-block;
  background: rgba(0, 200, 83, 0.2);
  color: var(--f1-success);
  font-size: 0.85rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-top: 0.2rem;
}

/* ── Prediction Form ── */

.prediction-header {
  margin-bottom: 1.5rem;
}

.prediction-header h2 {
  font-size: 1.7rem;
  margin-bottom: 0.35rem;
}

.prediction-header .race-meta {
  margin-bottom: 0.5rem;
}

.lock-info {
  padding: 0.6rem 0.85rem;
  background: rgba(255, 145, 0, 0.1);
  border: 1px solid rgba(255, 145, 0, 0.3);
  border-radius: var(--radius);
  color: var(--f1-warning);
  font-size: 1rem;
}

.prediction-section {
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.prediction-section h3 {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.position-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.position-label {
  min-width: 32px;
  text-align: center;
  padding: 0.25rem 0;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
}

.position-label.p1 { background: var(--f1-gold); color: #111; }
.position-label.p2 { background: var(--f1-silver); color: #111; }
.position-label.p3 { background: var(--f1-bronze); color: #111; }

.driver-select {
  flex: 1;
  padding: 0.7rem 0.85rem;
  background: var(--f1-darker);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  color: var(--f1-text);
  font-size: 1.1rem;
  font-family: inherit;
  cursor: pointer;
}

.driver-select:focus {
  border-color: var(--f1-red);
  outline: none;
}

.driver-select option {
  padding: 0.4rem;
}

.prediction-actions {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.6rem;
}

.points-display {
  font-size: 1rem;
  color: var(--f1-text-dim);
  margin-top: 0.35rem;
}

.points-display .points-value {
  font-weight: 700;
}

/* ── Results Display ── */

.result-display {
  padding: 1.2rem;
  background: rgba(0, 200, 83, 0.08);
  border: 1px solid rgba(0, 200, 83, 0.2);
  border-radius: var(--radius);
  margin-top: 1.2rem;
}

.result-display h4 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  color: var(--f1-success);
}

.result-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  font-size: 1rem;
}

.result-row .driver-color {
  width: 4px;
  height: 22px;
  border-radius: 2px;
}

.match-yes {
  color: var(--f1-success);
  font-weight: 600;
}

.match-no {
  color: var(--f1-text-dim);
}

.score-earned {
  margin-left: auto;
  font-weight: 700;
  color: var(--f1-gold);
}

/* ── Driver Color Indicator ── */

.driver-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── Leaderboard Table ── */

.leaderboard-table {
  width: 100%;
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  overflow: hidden;
  border-collapse: collapse;
  table-layout: fixed;
}

.leaderboard-table thead {
  background: var(--f1-bg-secondary);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--f1-border);
}

.leaderboard-table th {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--f1-text-dim);
}

.leaderboard-table tbody tr:hover {
  background: var(--f1-bg-secondary);
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column widths */
.rank-cell {
  width: 40px !important;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  padding: 0.75rem 0.25rem !important;
}

.username-cell {
  width: auto;
  min-width: 150px;
}

.points-cell {
  width: 120px;
  text-align: center;
  font-weight: 700;
  color: var(--f1-gold);
}

.detail-cell {
  width: 110px;
  text-align: center;
}

/* Rank styling */
.rank-1 {
  color: var(--f1-gold);
  font-weight: 900;
  font-size: 1.1rem;
}

.rank-2 {
  color: #C0C0C0;
  font-weight: 900;
}

.rank-3 {
  color: #CD7F32;
  font-weight: 900;
}

.sorted {
  color: var(--f1-text);
}

/* ── My Predictions Summary ── */

.my-pred-card {
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.6rem;
}

.my-pred-card h4 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.my-pred-drivers {
  font-size: 1.1rem;
  color: var(--f1-text-dim);
}

.my-pred-score {
  font-size: 1.1rem;
  margin-top: 0.35rem;
}

/* ── Settings ── */

.settings-card {
  background: var(--f1-card);
  border: 1px solid var(--f1-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
}

.settings-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.85rem;
}

/* ── Footer ── */

.footer {
  background: var(--f1-darker);
  border-top: 1px solid var(--f1-border);
  padding: 1rem;
  text-align: center;
  font-size: 1rem;
  color: var(--f1-text-dim);
  margin-top: 2rem;
}

.footer-link {
  color: var(--f1-text-dim);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--f1-text);
}

/* ── Loading ── */

.loading {
  text-align: center;
  padding: 2.5rem;
  color: var(--f1-text-dim);
  font-size: 1.1rem;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--f1-border);
  border-top-color: var(--f1-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Empty state ── */

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--f1-text-dim);
  font-size: 1.1rem;
}

.empty-state h3 {
  color: var(--f1-text);
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }
  
  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .brand-title {
    font-size: 1.2rem;
  }
  
  .brand-subtitle {
    font-size: 0.9rem;
  }
  
  .race-card {
    flex-wrap: wrap;
    gap: 0.7rem;
  }
  
  .race-status {
    text-align: left;
    min-width: auto;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.95rem;
  }
  
  .position-row {
    flex-wrap: wrap;
  }
  
  .prediction-actions {
    flex-direction: column;
  }
  
  .detail-cell {
    display: none;
  }
}

@media (max-width: 400px) {
  .nav-btn {
    padding: 0.7rem 0.75rem;
    font-size: 0.9rem;
  }

   /* Mobile modal optimizations */
.modal {
  padding-top: 40px;
}

.modal-content {
  padding: 1.2rem;
}

.modal-play {
  font-size: 2rem;
}

.modal-subtitle {
  font-size: 1rem;
}

.modal-content p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 0.8rem;
}

.form-group label {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}
}

/* ── Utility ── */

.text-center { text-align: center; }
.text-dim { color: var(--f1-text-dim); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ── Success Animation ── */

@keyframes champagne-spray {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.champagne-celebration {
  animation: champagne-spray 0.5s ease-in-out;
}
/* ── Modal Heading Custom Styling ── */

.modal-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.modal-play {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--f1-red);
  letter-spacing: 0.1em;
}

.modal-subtitle {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--f1-text);
}
