/* TALIFIT RACE 2026 — Design System Premium Ocean */
:root {
  --bg: #040d12;
  --surface: rgba(10,30,40,0.6);
  --card: rgba(12,35,48,0.55);
  --card-border: rgba(0,229,160,0.12);
  --green: #00e5a0;
  --green-glow: rgba(0,229,160,0.35);
  --green-dim: rgba(0,229,160,0.08);
  --teal: #00bcd4;
  --orange: #ff8c42;
  --orange-dim: rgba(255,140,66,0.1);
  --red: #f44336;
  --text: #f0f6f8;
  --text-muted: #6a8a96;
  --text-sub: #3a5a66;
  --gold: #ffd166;
  --silver: #c0c8cc;
  --bronze: #cd8f52;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --radius: 20px;
  --radius-sm: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* === ANIMATED OCEAN BACKGROUND === */
.ocean-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
}
.ocean-bg::before {
  content: '';
  position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
  background:
    radial-gradient(ellipse 40% 30% at 30% 20%, rgba(0,188,212,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 80%, rgba(0,229,160,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 35% 25% at 60% 10%, rgba(0,150,200,0.06) 0%, transparent 50%);
  animation: oceanDrift 20s ease-in-out infinite alternate;
}
@keyframes oceanDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-2%, 1%) rotate(0.5deg); }
  66% { transform: translate(1%, -1%) rotate(-0.3deg); }
  100% { transform: translate(-1%, 2%) rotate(0.2deg); }
}

/* Floating particles */
.particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.particle {
  position: absolute; width: 3px; height: 3px;
  background: rgba(0,229,160,0.3); border-radius: 50%;
  animation: float linear infinite;
}
.particle:nth-child(1) { left: 10%; width: 2px; height: 2px; animation-duration: 18s; }
.particle:nth-child(2) { left: 25%; animation-duration: 22s; animation-delay: -4s; }
.particle:nth-child(3) { left: 45%; width: 2px; height: 2px; animation-duration: 16s; animation-delay: -8s; background: rgba(0,188,212,0.25); }
.particle:nth-child(4) { left: 65%; width: 4px; height: 4px; animation-duration: 24s; animation-delay: -2s; }
.particle:nth-child(5) { left: 80%; width: 2px; height: 2px; animation-duration: 20s; animation-delay: -6s; background: rgba(0,188,212,0.2); }
.particle:nth-child(6) { left: 35%; animation-duration: 19s; animation-delay: -10s; }
.particle:nth-child(7) { left: 55%; width: 2px; height: 2px; animation-duration: 21s; animation-delay: -3s; background: rgba(0,188,212,0.3); }
.particle:nth-child(8) { left: 90%; animation-duration: 17s; animation-delay: -7s; }

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; transform: translateY(90vh) scale(1); }
  90% { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

/* === LAYOUT === */
.page { position: relative; z-index: 1; }
.container { max-width: 960px; margin: 0 auto; padding: 16px; position: relative; z-index: 1; }
.container-narrow { max-width: 440px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }

/* === HEADER === */
.header {
  padding: 28px 8px 20px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  opacity: 0; animation: revealDown 0.7s cubic-bezier(0.16,1,0.3,1) 0.2s forwards;
}
.header h1 {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: 4px; color: var(--text);
}
.header .subtitle {
  font-size: 10px; font-weight: 600; letter-spacing: 3px;
  color: var(--text-muted); text-transform: uppercase;
}
.header .divider {
  width: 1px; height: 24px;
  background: linear-gradient(to bottom, transparent, var(--text-sub), transparent);
}

/* === CARDS — Glassmorphism === */
.card {
  background: var(--card);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 12px;
  position: relative;
  opacity: 0; animation: revealUp 0.6s ease 0.4s forwards;
}
.card::before {
  content: '';
  position: absolute; top: -1px; right: -1px; bottom: -1px; left: -1px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0,229,160,0.1), transparent 40%, transparent 60%, rgba(0,188,212,0.06));
  z-index: -1; filter: blur(1px);
}

/* === BADGE === */
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px; border-radius: 100px;
  font-size: 14px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
  position: relative; overflow: hidden;
}
.badge-valid {
  background: linear-gradient(135deg, rgba(0,229,160,0.2), rgba(0,188,212,0.12));
  border: 1.5px solid rgba(0,229,160,0.5);
  color: var(--green);
  box-shadow: 0 0 20px rgba(0,229,160,0.25), 0 0 50px rgba(0,229,160,0.1);
  animation: badgePulse 2.5s ease-in-out infinite;
}
.badge-valid::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: shimmer 3s ease-in-out 1.5s infinite;
}
.badge-pending {
  background: var(--orange-dim);
  border: 1px solid rgba(255,140,66,0.3);
  color: var(--orange);
}
.badge-done {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--text-sub);
  color: var(--text-muted);
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,229,160,0.25), 0 0 50px rgba(0,229,160,0.1); }
  50% { box-shadow: 0 0 30px rgba(0,229,160,0.4), 0 0 70px rgba(0,229,160,0.15); }
}
@keyframes shimmer {
  0% { left: -100%; }
  40% { left: 100%; }
  100% { left: 100%; }
}

/* === INFO ROWS === */
.info-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 15px;
}
.info-row:last-child { border-bottom: none; }
.info-icon { width: 24px; text-align: center; flex-shrink: 0; }
.info-label {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-sub); min-width: 80px;
}
.info-value { font-weight: 500; color: var(--text); }

/* === NAMES === */
.participant-name {
  font-family: var(--font-display);
  font-size: 44px; letter-spacing: 1.5px; line-height: 1;
  color: var(--text); margin: 16px 0 8px;
}
.participant-country {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 16px;
}

/* === BUTTONS === */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 64px;
  font-size: 16px; font-weight: 800; font-family: var(--font-body);
  border: none; border-radius: var(--radius);
  cursor: pointer; letter-spacing: 2px; text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.2s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-green {
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #000;
  box-shadow: 0 4px 20px rgba(0,229,160,0.3);
}
.btn-green:hover { box-shadow: 0 6px 30px rgba(0,229,160,0.4); }
.btn-red { background: var(--red); color: #fff; }
.btn-outline {
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1.5px solid var(--card-border);
  color: var(--text);
}
.btn-outline:hover { border-color: rgba(0,229,160,0.3); }

/* === SPINNER === */
.spinner {
  width: 44px; height: 44px;
  border: 2px solid rgba(0,229,160,0.1);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === LOADING === */
.loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; gap: 16px;
}
.loading-text { color: var(--text-muted); font-size: 14px; letter-spacing: 1px; }

/* === ERROR === */
.error-screen { text-align: center; padding: 60px 20px; }
.error-screen h2 { color: var(--red); margin-bottom: 8px; font-family: var(--font-display); font-size: 28px; letter-spacing: 2px; }
.error-screen p { color: var(--text-muted); }

/* === CHRONO DISPLAY === */
.chrono-big {
  font-family: var(--font-display); font-size: 46px;
  color: var(--gold); letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(255,209,102,0.3);
  font-variant-numeric: tabular-nums;
}
.chrono-rank { font-size: 18px; color: var(--gold); margin-top: 4px; }

/* === SECTION TITLES === */
.section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-sub);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--card-border), transparent);
}

/* === ACCESS PILLS === */
.access-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.access-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 100px;
  background: linear-gradient(135deg, rgba(0,229,160,0.06), rgba(0,188,212,0.04));
  border: 1px solid rgba(0,229,160,0.15);
  font-size: 12px; font-weight: 600; color: var(--green); letter-spacing: 0.5px;
}

/* === ACCORDION === */
.accordion-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer; margin-bottom: 4px;
  font-weight: 600; user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.accordion-header:hover { border-color: rgba(0,229,160,0.25); }
.accordion-header .count { color: var(--text-sub); font-weight: 400; font-size: 13px; }
.accordion-header .arrow { transition: transform 0.2s; }
.accordion-header.open .arrow { transform: rotate(90deg); }
.accordion-content { display: none; padding: 4px 0 8px 12px; }
.accordion-content.open { display: block; }

/* === RESULTS ROWS === */
.result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 14px;
}
.result-rank { width: 32px; font-weight: 700; text-align: center; flex-shrink: 0; font-family: var(--font-display); font-size: 18px; }
.result-name { flex: 1; font-weight: 500; }
.result-flag { flex-shrink: 0; }
.result-chrono { font-variant-numeric: tabular-nums; color: var(--green); font-weight: 600; }
.rank-1 .result-rank { color: var(--gold); font-size: 22px; }
.rank-2 .result-rank { color: var(--silver); font-size: 20px; }
.rank-3 .result-rank { color: var(--bronze); font-size: 20px; }

/* === SEARCH === */
.search-input {
  width: 100%; padding: 14px 18px;
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text); font-size: 15px; font-family: var(--font-body);
  outline: none; margin-bottom: 16px;
}
.search-input:focus { border-color: rgba(0,229,160,0.4); box-shadow: 0 0 15px rgba(0,229,160,0.1); }
.search-input::placeholder { color: var(--text-sub); }

/* === DASHBOARD CHRONO LAYOUT === */
.chrono-layout {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; min-height: calc(100vh - 120px);
}
@media (max-width: 768px) { .chrono-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  backdrop-filter: blur(30px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px;
}
.panel-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-sub);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
}

/* === RACE ITEMS === */
.race-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.race-name { font-weight: 600; font-size: 15px; }
.race-status { color: var(--text-sub); font-size: 12px; letter-spacing: 0.5px; }
.btn-start {
  padding: 10px 20px; height: auto; width: auto;
  font-size: 12px; border-radius: var(--radius-sm);
}

/* === LIVE FEED === */
.live-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 14px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }
.live-rank { width: 28px; font-weight: 700; text-align: center; font-family: var(--font-display); font-size: 18px; }
.live-name { flex: 1; }
.live-chrono { color: var(--green); font-variant-numeric: tabular-nums; font-weight: 600; }

/* === PROGRESS BAR === */
.progress-bar {
  width: 100%; height: 6px;
  background: rgba(0,229,160,0.1); border-radius: 3px;
  overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--teal));
  border-radius: 3px; transition: width 0.5s ease;
}

/* === PIN SCREEN === */
.pin-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; gap: 20px;
  position: relative; z-index: 1;
}
.pin-input {
  font-size: 32px; text-align: center;
  width: 200px; padding: 14px;
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 2px solid var(--card-border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); letter-spacing: 12px;
  outline: none;
}
.pin-input:focus { border-color: rgba(0,229,160,0.5); box-shadow: 0 0 20px rgba(0,229,160,0.15); }
.pin-error { color: var(--red); font-size: 14px; }

/* === FOOTER === */
.footer {
  text-align: center; padding: 28px 24px;
  position: relative;
}
.footer::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
}
.footer-event {
  font-family: var(--font-display);
  font-size: 20px; letter-spacing: 6px; color: var(--text-sub); margin-bottom: 6px;
}
.footer-location { font-size: 11px; color: var(--text-sub); letter-spacing: 1px; }
.footer-nfc { margin-top: 12px; font-size: 10px; color: rgba(255,255,255,0.15); letter-spacing: 1px; }

/* Backward compat — simple footer */
.footer p { color: var(--text-sub); font-size: 12px; }

/* === OFFLINE BANNER === */
.offline-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--orange); color: #000;
  text-align: center; padding: 10px; font-size: 13px; font-weight: 600;
  z-index: 100; display: none;
  letter-spacing: 0.5px;
}
.offline-banner.show { display: block; }

/* === SEARCH HIGHLIGHT === */
mark {
  background: var(--green-dim); color: var(--green);
  padding: 1px 3px; border-radius: 3px;
}

/* === ANIMATIONS === */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes revealDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes revealScale {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
