/* =========================================================
   F1 TRACKER — STYLE.CSS (Clean rewrite)
   - Variables + reset + composants
   - Compatible avec les anciennes classes + nouvelles pages
   ========================================================= */

/* -------------------------
   1) VARIABLES (THEME)
   ------------------------- */
:root {
  --bg: #0b0b12;
  --panel: #111827;
  --panel-2: #020617;
  --border: #1f2937;

  --text: #f5f5f5;
  --text-2: #e5e7eb;
  --muted: #9ca3af;
  --muted-2: #d1d5db;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --pill: 999px;

  --shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.4);

  --maxw: 1100px;
  --gap: 1rem;
}

/* -------------------------
   2) RESET + BASE
   ------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 1.5rem 2rem;
}

/* Limite de largeur “pro” */
main > * {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

/* Utilitaire */
.hidden {
  display: none !important;
}

/* Titres */
h1, h2, h3 {
  margin: 0 0 0.6rem;
  line-height: 1.15;
}

p {
  margin: 0.5rem 0;
  color: var(--muted-2);
}

/* -------------------------
   3) HEADER / NAV
   ------------------------- */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header h1 {
  font-size: 1.4rem;
  margin: 0;
  color: var(--text);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

nav a {
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.95rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
}

nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}

nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

/* Responsive header */
@media (max-width: 720px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -------------------------
   4) BUTTONS
   ------------------------- */
button,
a.button-link {
  font-family: inherit;
  text-decoration: none;
}

.primary-btn,
.secondary-btn,
.back-btn,
a.primary-btn,
a.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--pill);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.primary-btn,
a.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover,
a.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.secondary-btn,
a.secondary-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.secondary-btn:hover,
a.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

/* Bouton retour (petit) */
.back-btn {
  padding: 0.45rem 0.95rem;
  font-size: 0.92rem;
  background: transparent;
  border: 1px solid #4b5563;
  color: var(--text-2);
  margin-bottom: 1rem;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* -------------------------
   5) ACCUEIL (HERO)
   ------------------------- */
.hero {
  text-align: center;
  margin-top: 3rem;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.hero p {
  color: var(--muted);
}

.hero-buttons {
  margin-top: 1.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* -------------------------
   6) TEXT HELPERS
   ------------------------- */
.section-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: -0.2rem;
}

/* Messages */
.error {
  background: rgba(185, 28, 28, 0.12);
  border: 1px solid rgba(185, 28, 28, 0.35);
  color: #fee2e2;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
}

/* -------------------------
   7) CALENDRIER (GRILLE)
   ------------------------- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 1.5rem;
}

.race-card {
  display: block;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.race-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  background: var(--panel-2);
}

.race-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.race-circuit {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.95rem;
}

.race-date {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* -------------------------
   8) DETAIL GP (LAYOUT)
   ------------------------- */
.gp-detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 2rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.gp-detail-left {
  position: relative;
}

.gp-detail-right {
  min-width: 0;
}

@media (max-width: 700px) {
  .gp-detail-layout {
    grid-template-columns: 1fr;
  }
}

/* Nouveau bloc “card” (grandprix refactor) */
.gp-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.gp-info p {
  margin: 0.18rem 0;
  color: var(--muted-2);
}

/* Image circuit — cliquable pour zoom */
.circuit-img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  margin-bottom: 1rem;
  cursor: zoom-in;
}

/* -------------------------
   9) TABLES
   ------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table,
.livetiming-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th,
td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

/* Ligne focus live timing */
.livetiming-row-focus {
  background: rgba(255, 255, 255, 0.04);
}

/* -------------------------
   10) FOOTER
   ------------------------- */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 2rem;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0.35rem 0;
  color: var(--muted);
}

.site-footer a {
  color: #93c5fd;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* -------------------------
   11) IMAGE MODAL (zoom)
   ------------------------- */
.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.image-modal.open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.image-modal-content {
  position: relative;
  z-index: 1;
  max-width: min(95vw, 1000px);
  max-height: 90vh;
  padding: 0.5rem;
  background: var(--panel-2);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-content img {
  max-width: 100%;
  max-height: calc(90vh - 3rem);
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  color: #f9fafb;
  font-size: 1.6rem;
  cursor: pointer;
}

/* -------------------------
   12) LIVE TIMING (cards)
   ------------------------- */
.livetiming-main-card {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.livetiming-main-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.livetiming-meeting-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.livetiming-session-name {
  margin: 0.2rem 0;
  color: var(--text-2);
}

.livetiming-session-type {
  color: var(--muted);
  font-size: 0.9rem;
}

.livetiming-circuit {
  margin: 0.4rem 0 0.8rem 0;
  color: var(--muted-2);
}

.livetiming-hint {
  margin-top: 0.8rem;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Pastille statut (Live / À venir / Terminée) */
.live-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.65rem;
  border-radius: var(--pill);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.live-status-pill.live {
  background: #b91c1c;
  color: #fee2e2;
}

.live-status-pill.upcoming {
  background: #065f46;
  color: #d1fae5;
}

.live-status-pill.finished {
  background: #4b5563;
  color: #e5e7eb;
}

/* -------------------------
   13) LIVE TIMING — BANDEAU
   ------------------------- */
.livetiming-banner {
  margin-top: 0.5rem;
  padding: 1rem 1.6rem;
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.8rem;
}

.livetiming-banner-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.livetiming-flag img {
  height: 28px;
  width: auto;
  border-radius: 2px;
}

.livetiming-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.livetiming-gp-line {
  font-size: 1.1rem;
}

.livetiming-gp-name {
  font-weight: 900;
  color: var(--text);
}

.livetiming-session-line {
  font-size: 0.95rem;
  color: var(--muted-2);
}

.livetiming-dates-line {
  font-size: 0.9rem;
  color: var(--muted);
}

.livetiming-dates-line .sep {
  margin: 0 0.35rem;
  opacity: 0.7;
}

.livetiming-banner-right {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.livetiming-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.8rem;
}

.livetiming-metric .label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.livetiming-metric .value {
  color: var(--text-2);
  font-weight: 800;
}

/* Responsive bandeau */
@media (max-width: 820px) {
  .livetiming-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .livetiming-banner-right {
    width: 100%;
    justify-content: flex-start;
  }

  .livetiming-metric {
    align-items: flex-start;
  }
}

/* -------------------------
   14) LIVE TIMING — COUNTDOWN
   ------------------------- */
.livetiming-countdown-wrap {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.livetiming-countdown {
  width: 100%;
  max-width: var(--maxw);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 800;
  text-align: center;
}

/* -------------------------
   15) LIVE TIMING — TRACK STATUS BADGE
   ------------------------- */
.track-status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--pill);
  font-weight: 900;
  font-size: 0.85rem;
  line-height: 1;
  color: #0b0b12;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.track-status--green  { background: #2ecc71; }
.track-status--yellow { background: #f1c40f; }
.track-status--red    { background: #e74c3c; }


/* =========================================================
   HOME (index.php) — Landing page
   ========================================================= */

.home-hero {
  margin-top: 1rem;
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.home-hero-content h2 {
  font-size: 2.2rem;
  margin: 0.6rem 0 0.6rem;
}

.home-lead {
  max-width: 70ch;
  color: var(--muted-2);
  margin: 0.2rem 0 1.2rem;
}

.home-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1rem;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--pill);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text-2);
}

.home-meta {
  margin-top: 1.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.home-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

.home-card {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  background: var(--panel-2);
}

.home-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.25rem;
  flex: 0 0 auto;
}

.home-card-body h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.home-card-body p {
  margin: 0.35rem 0 0.5rem;
  color: var(--muted-2);
  font-size: 0.93rem;
}

.home-card-link {
  color: #93c5fd;
  font-weight: 800;
  font-size: 0.92rem;
}

.home-about {
  margin-top: 1.8rem;
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  border: 1px solid var(--border);
}
