/* =====================================================
   FORMULE -1 · Styles Principaux
   Inspiré Racenet — Dark, Pro, F1
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,300;0,400;0,600;0,700;0,900;1,400&display=swap');

/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #E10600;
  --red-dark: #A00400;
  --bg:       #080808;
  --bg2:      #0d0d0d;
  --surface:  #111111;
  --card:     #141414;
  --border:   #1e1e1e;
  --border2:  #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #666;
  --muted2:   #444;
  --green:    #22c55e;
  --yellow:   #f59e0b;
  --blue:     #3b82f6;
  --purple:   #a855f7;
  --gold:     #FFD700;
  --silver:   #C0C0C0;
  --bronze:   #CD7F32;
  --font:     'Titillium Web', sans-serif;
  --radius:   8px;
  --radius-lg:12px;
  --shadow:   0 4px 24px rgba(0,0,0,.6);
  --shadow-sm:0 2px 8px rgba(0,0,0,.4);
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; min-height: 100vh; }

a { color: var(--red); text-decoration: none; transition: color .15s; }
a:hover { color: #ff3020; }

input, select, textarea, button { font-family: var(--font); }

/* ─── Layout ────────────────────────────────────── */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 28px 24px; max-width: 1280px; margin: 0 auto; width: 100%; }

/* ─── Header / Navbar ───────────────────────────── */
.navbar {
  background: var(--bg2);
  border-bottom: 2px solid var(--red);
  position: sticky; top: 0; z-index: 200;
  height: 60px; display: flex; align-items: center;
  padding: 0 24px; gap: 0;
  box-shadow: 0 2px 20px rgba(225,6,0,.15);
}

.navbar-brand {
  font-weight: 900; font-size: 22px; letter-spacing: 3px;
  color: #fff; white-space: nowrap; margin-right: 32px;
  display: flex; align-items: center; gap: 4px;
}
.navbar-brand .accent { color: var(--red); }

.navbar-season {
  font-size: 10px; color: var(--muted); letter-spacing: 2px;
  font-weight: 400; margin-left: 12px; border-left: 1px solid var(--border2);
  padding-left: 12px; text-transform: uppercase;
}

.navbar-nav { display: flex; gap: 2px; flex: 1; align-items: center; }
.nav-link {
  color: var(--muted); font-weight: 700; font-size: 11px;
  letter-spacing: .8px; text-transform: uppercase;
  padding: 8px 14px; border-radius: var(--radius);
  transition: all .15s; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-link.active { background: var(--red); color: #fff; }
.nav-link .icon { font-size: 14px; }

.navbar-user {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
  border-left: 1px solid var(--border2); padding-left: 16px;
}
.user-name { font-size: 13px; color: var(--text); font-weight: 600; }

/* Sub-bar (saison switcher) */
.subbar {
  background: #0a0a0a; border-bottom: 1px solid var(--border);
  padding: 6px 24px; display: flex; align-items: center; gap: 12px;
  font-size: 11px;
}

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 11px; letter-spacing: 2px; color: var(--red);
  font-weight: 800; text-transform: uppercase; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Grid Layouts ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

/* ─── KPI Boxes ─────────────────────────────────── */
.kpi-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .2s;
}
.kpi-box:hover { border-color: var(--border2); }
.kpi-box.alert { border-color: rgba(225,6,0,.4); }
.kpi-icon { font-size: 24px; margin-bottom: 4px; }
.kpi-value { font-size: 26px; font-weight: 900; color: #fff; line-height: 1; }
.kpi-value.red { color: var(--red); }
.kpi-sub { font-size: 12px; color: var(--red); font-weight: 700; }
.kpi-label { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

/* ─── Tables ────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 14px;
  color: var(--red); font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; border-bottom: 1px solid var(--border);
  font-weight: 800;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #151515; font-size: 13px; vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table tbody tr.leader { background: rgba(225,6,0,.04); }

/* ─── Pilot Avatar ──────────────────────────────── */
.pilot-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900;
  flex-shrink: 0;
}
.pilot-avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 10px; }
.pilot-avatar.xl { width: 72px; height: 72px; font-size: 24px; border-radius: 12px; border-width: 3px !important; }

/* ─── Pilot Card ────────────────────────────────── */
.pilot-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.pilot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pilot-card-header {
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.pilot-card-stats {
  display: grid; grid-template-columns: repeat(4,1fr);
  border-top: 1px solid var(--border);
}
.pilot-stat {
  padding: 10px 6px; text-align: center;
  border-right: 1px solid #151515;
}
.pilot-stat:last-child { border-right: none; }
.pilot-stat-val { font-size: 16px; font-weight: 900; }
.pilot-stat-lbl { font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.pilot-card-actions {
  padding: 8px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

/* ─── Position Badge ────────────────────────────── */
.pos-badge {
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; flex-shrink: 0;
}
.pos-1 { background: var(--gold); color: #000; }
.pos-2 { background: var(--silver); color: #000; }
.pos-3 { background: var(--bronze); color: #000; }
.pos-other { background: rgba(255,255,255,.08); color: #fff; }

/* ─── Badges / Tags ─────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  border: 1px solid;
}
.badge-red    { color: var(--red);    background: rgba(225,6,0,.12);    border-color: rgba(225,6,0,.3); }
.badge-green  { color: var(--green);  background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.3); }
.badge-yellow { color: var(--yellow); background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.badge-blue   { color: var(--blue);   background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); }
.badge-purple { color: var(--purple); background: rgba(168,85,247,.12); border-color: rgba(168,85,247,.3); }

.team-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  border: 1px solid;
}

/* ─── Forms ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; font-weight: 700; }
.form-control {
  background: #1a1a1a; border: 1px solid var(--border2);
  color: var(--text); padding: 10px 14px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; outline: none;
  width: 100%; transition: border-color .15s;
}
.form-control:focus { border-color: var(--red); }
.form-control::placeholder { color: var(--muted2); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-auto { grid-template-columns: 1fr 1fr 60px 1fr auto; }

/* ─── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius); border: none;
  font-family: var(--font); font-weight: 700; font-size: 12px;
  letter-spacing: .5px; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--red); color: #fff; }
.btn-primary:hover { background: #c00500; }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-ghost     { background: rgba(255,255,255,.06); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger    { background: transparent; color: var(--red); border: 1px solid rgba(225,6,0,.3); }
.btn-danger:hover { background: rgba(225,6,0,.1); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 28px;
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
  transform: scale(.95); transition: transform .2s;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal.wide { max-width: 760px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-title { font-size: 17px; font-weight: 800; color: var(--red); }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: #fff; background: var(--border2); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ─── Hero Banner ───────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #1a0000 0%, #0d0d0d 50%, #00081a 100%);
  border: 1px solid rgba(225,6,0,.2);
  border-radius: var(--radius-lg); padding: 30px;
  position: relative; overflow: hidden; margin-bottom: 24px;
}
.hero-banner::before {
  content: '🏎️'; position: absolute; right: -10px; top: -10px;
  font-size: 130px; opacity: .04; line-height: 1;
}
.hero-badge { font-size: 10px; color: var(--red); letter-spacing: 3px; text-transform: uppercase; margin-bottom: 8px; }
.hero-title { font-size: 36px; font-weight: 900; letter-spacing: 4px; margin-bottom: 8px; }
.hero-title .accent { color: var(--red); }
.hero-sub { color: var(--muted); font-size: 13px; }

/* ─── GP Calendar Card ──────────────────────────── */
.gp-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  border-left: 3px solid var(--muted2);
  transition: border-color .15s;
}
.gp-card.done   { border-left-color: var(--green); border-color: rgba(34,197,94,.15); }
.gp-card.pending{ border-left-color: var(--yellow); }
.gp-card.upcoming{ border-left-color: var(--muted2); }
.gp-flag { font-size: 22px; margin-bottom: 6px; }
.gp-name { font-weight: 700; font-size: 13px; }
.gp-circuit { color: var(--muted); font-size: 11px; margin-top: 2px; }
.gp-status { font-size: 10px; letter-spacing: .5px; margin-top: 6px; }
.gp-winner { font-size: 11px; color: var(--gold); margin-top: 4px; }

/* ─── Stewards / Réclamations ───────────────────── */
.steward-card {
  background: var(--card); border-radius: var(--radius-lg); padding: 18px;
  border: 1px solid;
}
.steward-card.pending { border-color: rgba(245,158,11,.3); }
.steward-card.accepted{ border-color: rgba(225,6,0,.3); }
.steward-card.rejected{ border-color: rgba(34,197,94,.3); }

/* ─── Stats H2H ─────────────────────────────────── */
.h2h-grid { display: grid; grid-template-columns: 1fr 60px 1fr; gap: 20px; align-items: start; }
.h2h-col { }
.h2h-name { font-weight: 900; font-size: 18px; margin-bottom: 6px; }
.h2h-pts { font-size: 32px; font-weight: 900; margin-bottom: 12px; }
.h2h-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #151515; font-size: 12px; }
.h2h-vs { text-align: center; font-size: 22px; font-weight: 900; color: var(--muted2); padding-top: 30px; }

/* ─── Progress bar ──────────────────────────────── */
.progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--red); border-radius: 2px; transition: width .3s; }

/* ─── Divider ───────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ─── Toast notification ────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--green); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: slideIn .2s ease;
}
.toast.error { background: var(--red); }
.toast.warn  { background: var(--yellow); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Login page ────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(225,6,0,.05) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,.04) 0%, transparent 50%);
}
.login-card {
  width: 400px; padding: 44px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo-text { font-size: 40px; font-weight: 900; letter-spacing: 4px; }
.login-subtitle { font-size: 11px; color: var(--muted); letter-spacing: 3px; text-transform: uppercase; margin-top: 6px; }
.login-hint { margin-top: 20px; padding: 12px; background: var(--bg2); border-radius: var(--radius); font-size: 11px; color: var(--muted); }

/* ─── Wizard steps ──────────────────────────────── */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.wizard-step.done { background: var(--red); }
.wizard-step.current { background: rgba(225,6,0,.5); }
.wizard-step-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 6px; letter-spacing: .5px; }

/* ─── Presence selector ─────────────────────────── */
.presence-btn { padding: 4px 10px; border-radius: 4px; border: 1px solid; font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s; }
.presence-btn.present  { border-color: var(--green);  color: var(--green);  background: rgba(34,197,94,.1); }
.presence-btn.absent   { border-color: var(--red);    color: var(--red);    background: rgba(225,6,0,.1); }
.presence-btn.late     { border-color: var(--yellow); color: var(--yellow); background: rgba(245,158,11,.1); }
.presence-btn.pending  { border-color: var(--muted2); color: var(--muted);  background: transparent; }

/* ─── Tabs (in-page) ────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 18px; background: none; border: none; color: var(--muted); font-family: var(--font); font-weight: 700; font-size: 12px; letter-spacing: .8px; cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; text-transform: uppercase; }
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ─── Utilities ─────────────────────────────────── */
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }
.text-purple { color: var(--purple); }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--muted); }
.text-white  { color: #fff; }
.text-bold   { font-weight: 900; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 11px; }
.text-lg     { font-size: 18px; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state-icon { font-size: 52px; margin-bottom: 14px; }
.empty-state-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 8px; }

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
  .navbar { padding: 0 14px; gap: 0; }
  .navbar-nav { display: none; }
  .main-content { padding: 16px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .h2h-grid { grid-template-columns: 1fr; }
  .h2h-vs { display: none; }
}

/* ─── League Selector ───────────────────────────── */
.league-selector-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
  color: var(--text); font-family: var(--font); transition: all .15s;
  flex-direction: column; align-items: flex-start; min-width: 130px;
}
.league-selector-btn:hover { border-color: var(--red); background: rgba(225,6,0,.06); }
.league-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); min-width: 200px; z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.6); padding: 6px;
}
.league-dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 12px; border-radius: var(--radius);
  background: none; border: none; color: var(--text); font-family: var(--font);
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: left;
  text-decoration: none; transition: background .12s;
}
.league-dropdown-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.league-dropdown-item.active { color: var(--red); }
