/* PaceMatch — Design System (Oliver) */
/* Palette : #F5F3EE (bg) · #1A1A1A (text) · #6B7C4A (green) */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg:         #F5F3EE;
  --surface:    #FAFAFA;
  --dark:       #1A1A1A;
  --green:      #FF6B47;
  --coral:      #FF6B47;
  --coral-lt:   #FFF0EC;
  --grey:       #9B9B9B;
  --ink-mid:    #6B6B6B;
  --ink-faint:  #D4D4D4;
  --grey-lt:    #E8E6E1;
  --white:      #FFFFFF;
  --success:    #1DB954;
  --radius:     16px;
  --radius-md:  18px;
  --radius-sm:  10px;
  --shadow:     0 2px 16px rgba(26,26,26,.08);
  --shadow-card: 0 2px 12px rgba(0,0,0,.07);
  --font:       'DM Sans', system-ui, sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--dark);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.app {
  max-width: 430px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* safe-area-top géré par chaque page, bottom géré par la nav */
}

/* Conteneur scrollable plein écran (remplace les inline height:100dvh) */
.full-scroll {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding-bottom: 90px;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: max(24px, env(safe-area-inset-top)) 20px 40px;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ── Typography ── */
.title    { font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.5px; }
.subtitle { font-size: 15px; color: var(--grey); margin-top: 8px; }
.label    { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--grey); }
.caption  { font-size: 13px; color: var(--grey); }

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 17px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-align: center;
  text-decoration: none;
}
.btn:active { transform: scale(.98); opacity: .85; }

.btn-primary   { background: var(--green); color: var(--white); }
.btn-dark      { background: var(--dark); color: var(--white); }
.btn-green     { background: var(--green); color: var(--white); }
.btn-coral     { background: var(--green); color: var(--white); }
.btn-outline   { background: transparent; border: 1.5px solid var(--grey-lt); color: var(--dark); }
.btn-ghost     { background: transparent; color: var(--grey); font-weight: 400; font-size: 15px; }
.btn-strava    { background: #FC4C02; color: var(--white); }

/* ── Form elements ── */
.input {
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--grey-lt);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 16px;
  background: var(--white);
  color: var(--dark);
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--green); }
.input::placeholder { color: var(--grey); }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── Pace tier chips ── */
.tier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.tier-card {
  border: 1.5px solid var(--grey-lt);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  background: var(--white);
}
.tier-card.selected {
  border-color: var(--coral);
  background: var(--coral);
  color: var(--white);
}
.tier-card .tier-pace { font-size: 18px; font-weight: 600; }
.tier-card .tier-label { font-size: 12px; opacity: .7; margin-top: 2px; }

/* ── Availability toggles ── */
.days-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.day-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--grey-lt);
  background: var(--white);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.day-toggle.active {
  border-color: var(--dark);
  background: var(--dark);
  color: var(--white);
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.time-btn {
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--grey-lt);
  background: var(--white);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.time-btn.active {
  border-color: var(--dark);
  background: var(--dark);
  color: var(--white);
}

/* ── Run card (home) ── */
.run-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.run-card-header {
  background: var(--dark);
  color: var(--white);
  padding: 24px 20px;
}
.run-date { font-size: 26px; font-weight: 600; }
.run-time { font-size: 15px; opacity: .7; margin-top: 2px; }
.run-card-body { padding: 20px; }
.run-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--grey-lt);
  color: var(--dark);
}
.badge-green { background: #FFF0EC; color: var(--green); }

/* ── Participants avatars ── */
.avatars {
  display: flex;
  gap: -8px;
  margin-bottom: 20px;
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--white);
  background: var(--grey-lt);
  object-fit: cover;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  color: var(--dark);
  flex-shrink: 0;
}
.avatar + .avatar { margin-left: -12px; }

/* ── Post-run ── */
.participant-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey-lt);
}
.participant-row:last-child { border-bottom: none; }
.participant-name { font-weight: 500; flex: 1; }
.rematch-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--grey-lt);
  background: var(--white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: all .15s;
}
.rematch-btn.active {
  border-color: var(--green);
  background: #FFF0EC;
}

/* ── Empty state ── */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 40px 20px;
}
.empty-icon { font-size: 48px; }
.empty-text { font-size: 17px; font-weight: 500; }
.empty-sub  { font-size: 14px; color: var(--grey); max-width: 260px; }

/* ── Progress (onboarding) ── */
.progress-bar {
  height: 4px;
  background: var(--coral-lt);
  border-radius: 2px;
  margin-bottom: 36px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--coral);
  border-radius: 2px;
  transition: width .35s ease;
}

/* ── Onboarding input (underline) ── */
.onboarding-input {
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--ink-faint);
  background: transparent;
  font-family: var(--font);
  font-size: 24px;
  font-weight: 500;
  color: var(--dark);
  padding: 8px 0 10px;
  outline: none;
  transition: border-color .2s;
}
.onboarding-input:focus { border-bottom-color: var(--coral); }
.onboarding-input::placeholder { color: var(--ink-faint); font-weight: 400; }

/* ── Slot card (home) ── */
.slot-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 22px 20px;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.slot-card.inscrit {
  border-left-color: var(--coral);
  background: #FFF8F6;
}
.slot-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
  transition: background .2s;
}
.slot-dot.active { background: var(--success); }

/* ── Nav bar ── */
.nav-svg { display: block; transition: color .15s; }

/* ── Nav bar ── */
.nav {
  display: flex;
  justify-content: space-around;
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  background: var(--white);
  box-shadow: 0 -1px 0 var(--ink-faint);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 20px;
  transition: color .15s;
}
.nav-item.active { color: var(--coral); font-weight: 600; }
.nav-icon { font-size: 22px; }

/* ── Dividers & spacing ── */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.gap-12 { display: flex; flex-direction: column; gap: 12px; }

/* ── Photo upload ── */
.photo-upload {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px dashed var(--grey-lt);
  background: var(--white);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 28px;
  margin: 0 auto 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.photo-upload:hover { border-color: var(--dark); }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; position: absolute; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: slideUp .25s ease;
  white-space: nowrap;
}
@keyframes slideUp { from { opacity:0; transform: translateX(-50%) translateY(10px); } to { opacity:1; } }

/* ── Spinner ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--grey-lt);
  border-top-color: var(--dark);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
