/* ============================================================
   style.css – F1 Predictor global styles
   Palette: dark bg, F1 red (#e10600), white text
   ============================================================ */

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

:root {
  --red:      #e10600;
  --red-dark: #a80400;
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --surface2: #242424;
  --border:   #333;
  --text:     #f0f0f0;
  --muted:    #888;
  --radius:   8px;
  --font:     'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth pages (login / register) ── */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(225, 6, 0, 0.12) 0%, transparent 60%),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
}

.auth-logo .flag { font-size: 1.6rem; }

.auth-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-logo h1 span { color: var(--red); }

.auth-card h2 {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 1.6rem;
  font-weight: 400;
}

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.2s;
  outline: none;
}

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

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  width: 100%;
  margin-top: 0.4rem;
}

.btn-primary:hover { background: var(--red-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface2); }

.auth-footer {
  margin-top: 1.2rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

/* ── Alert / error ── */
.alert {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: rgba(225, 6, 0, 0.15); border: 1px solid var(--red); color: #ff8a86; }
.alert-success { background: rgba(0, 200, 80, 0.12); border: 1px solid #00c850; color: #5dffa4; }

/* ── Dashboard layout ── */
.dash-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.dash-logo span { color: var(--red); }

.dash-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.dash-user strong { color: var(--text); }

.dash-main {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.card h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card .placeholder-text {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.5rem;
}

/* ── Utility ── */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  border-left: 3px solid var(--red);
  padding-left: 0.75rem;
}

/* ── Clickable card (Next Race → calendar.html) ── */
.card-clickable {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.card-clickable:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(225, 6, 0, 0.15);
  text-decoration: none;
}

.card-arrow {
  opacity: 0.45;
  font-style: normal;
  margin-left: 0.3rem;
  transition: opacity 0.2s, transform 0.2s;
  display: inline-block;
}

.card-clickable:hover .card-arrow {
  opacity: 1;
  transform: translateX(3px);
}

/* ── Calendar page subtitle ── */
.cal-page-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.5rem 0 1.5rem;
  padding-left: 0.2rem;
}

/* ── Race grid (calendar.html) ── */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0;
}

.race-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform 0.15s, border-color 0.15s;
}

.race-card--past {
  opacity: 0.35;
}

.race-card--next {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red), 0 4px 20px rgba(225, 6, 0, 0.18);
  background: rgba(225, 6, 0, 0.06);
}

.race-card--future {
  opacity: 0.72;
}

.race-card--future:hover,
.race-card--next:hover {
  transform: translateY(-2px);
  border-color: var(--red);
  opacity: 1;
}

.rc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.rc-round {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.rc-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.7px;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.rc-badge--done {
  background: var(--surface2);
  color: var(--muted);
}

.rc-days {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

.rc-flag {
  font-size: 2rem;
  line-height: 1;
  margin: 0.1rem 0 0.35rem;
}

/* ── Race card body: text left, track right ── */
.rc-body {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex: 1;
}

.rc-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.rc-track-wrap {
  flex-shrink: 0;
  width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc-track-img {
  width: 100%;
  height: auto;
  max-height: 90px;
  object-fit: contain;
  /* Invert black SVG to white for the dark theme */
  filter: invert(1) opacity(0.55);
  transition: filter 0.2s;
}

.race-card--next .rc-track-img {
  filter: invert(1) opacity(0.85);
}

.race-card--past .rc-track-img {
  filter: invert(1) opacity(0.25);
}

.race-card:hover .rc-track-img {
  filter: invert(1) opacity(0.9);
}

.rc-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.rc-circuit {
  font-size: 0.72rem;
  color: var(--muted);
}

.rc-location {
  font-size: 0.72rem;
  color: var(--muted);
}

.rc-dates {
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 600;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ── Next Race card ── */
.next-race-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.5rem 0 0.25rem;
}

.next-race-flag {
  font-size: 2rem;
  display: block;
  margin: 0.3rem 0;
}

.next-race-dates {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.next-race-countdown {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  min-width: 52px;
}

.countdown-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
}

.countdown-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.15rem;
}

@media (max-width: 480px) {
  .auth-card { padding: 1.8rem 1.2rem; }
  .race-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
