/* ── Variables de thème ─────────────────────────────────────── */
:root {
  --bg: #f8f6f1;
  --carte: #ffffff;
  --texte: #1a1a1a;
  --texte-sec: #666666;
  --accent: #1D9E75;
  --accent-clair: #e8f7f2;
  --bordure: #e0ddd6;
  --ombre: 0 1px 4px rgba(0,0,0,0.08);
  --ombre-md: 0 2px 12px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

[data-theme="sombre"] {
  --bg: #1a1c1e;
  --carte: #242729;
  --texte: #e8e6e1;
  --texte-sec: #9a9893;
  --accent: #5DCAA5;
  --accent-clair: #1e3530;
  --bordure: #333638;
  --ombre: 0 1px 4px rgba(0,0,0,0.3);
  --ombre-md: 0 2px 12px rgba(0,0,0,0.4);
}

/* ── Icônes SVG ──────────────────────────────────────────────── */
.ico {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ── Structure de l'app ─────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 700px;
  margin: 0 auto;
}

/* ── En-tête ─────────────────────────────────────────────────── */
header {
  background: var(--carte);
  border-bottom: 1px solid var(--bordure);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--ombre);
}

.header-titre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
}

.header-titre .icone { font-size: 22px; }

.btn-theme {
  background: none;
  border: 1px solid var(--bordure);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.btn-theme:hover { background: var(--accent-clair); }

/* ── Navigation par onglets ─────────────────────────────────── */
nav {
  background: var(--carte);
  border-bottom: 1px solid var(--bordure);
  display: flex;
}

.onglet {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-sec);
  border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.onglet .icone-onglet { font-size: 20px; }

.onglet.actif {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Contenu principal ──────────────────────────────────────── */
main {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
}

.section { display: none; }
.section.active { display: block; }

/* ── Cartes de sortie ────────────────────────────────────────── */
.carte-sortie {
  background: var(--carte);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--ombre);
  border: 1px solid var(--bordure);
}

.sortie-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sortie-date {
  font-weight: 700;
  font-size: 16px;
}

.sortie-spot {
  font-size: 13px;
  color: var(--texte-sec);
  margin-top: 2px;
}

.badge-captures {
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-vert { background: #d4f0e4; color: #0e6b4a; }
.badge-orange { background: #fde8cc; color: #8a4800; }
.badge-gris { background: #e8e6e1; color: #666; }

[data-theme="sombre"] .badge-vert { background: #1a3d2d; color: #5DCAA5; }
[data-theme="sombre"] .badge-orange { background: #3d2a0a; color: #f0a048; }
[data-theme="sombre"] .badge-gris { background: #2a2c2e; color: #9a9893; }

.sortie-infos {
  font-size: 13px;
  color: var(--texte-sec);
  margin-bottom: 10px;
}

/* ── Pills météo ─────────────────────────────────────────────── */
.pills-meteo {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.pill {
  background: var(--accent-clair);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* ── Liste des captures ─────────────────────────────────────── */
.liste-captures {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-capture {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.capture-espece { font-weight: 600; }
.capture-taille { color: var(--texte-sec); }

.tag-relache {
  margin-left: auto;
  font-size: 11px;
  border-radius: 10px;
  padding: 2px 7px;
  font-weight: 500;
}

.tag-relache.relache { background: #d4f0e4; color: #0e6b4a; }
.tag-relache.garde { background: #fde8cc; color: #8a4800; }

[data-theme="sombre"] .tag-relache.relache { background: #1a3d2d; color: #5DCAA5; }
[data-theme="sombre"] .tag-relache.garde { background: #3d2a0a; color: #f0a048; }

/* ── Notes ───────────────────────────────────────────────────── */
.notes-sortie {
  font-size: 13px;
  color: var(--texte-sec);
  margin-top: 8px;
  font-style: italic;
  border-top: 1px solid var(--bordure);
  padding-top: 8px;
}

/* ── Actions de carte ────────────────────────────────────────── */
.sortie-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bordure);
}

.btn-sm {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bordure);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--texte-sec);
  transition: all var(--transition);
}

.btn-sm:hover { background: var(--accent-clair); color: var(--accent); border-color: var(--accent); }
.btn-sm.danger:hover { background: #fde8e8; color: #c0392b; border-color: #c0392b; }

[data-theme="sombre"] .btn-sm.danger:hover { background: #3d1a1a; color: #e07070; border-color: #e07070; }

/* ── Bouton principal flottant ──────────────────────────────── */
.btn-fab {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translateX(50%);
  max-width: 340px;
  width: calc(100% - 32px);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(29,158,117,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 50;
}

.btn-fab:hover { transform: translateX(50%) translateY(-2px); box-shadow: 0 6px 24px rgba(29,158,117,0.5); }
.btn-fab:active { transform: translateX(50%) translateY(0); }

/* ── Statistiques ────────────────────────────────────────────── */
.grille-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.carte-stat {
  background: var(--carte);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--ombre);
  border: 1px solid var(--bordure);
  text-align: center;
}

.stat-valeur {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--texte-sec);
  font-weight: 500;
}

.section-titre {
  font-size: 14px;
  font-weight: 700;
  color: var(--texte-sec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 20px 0 10px;
}

/* ── Tableaux ─────────────────────────────────────────────────── */
.tableau {
  background: var(--carte);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  border: 1px solid var(--bordure);
  overflow: hidden;
  margin-bottom: 16px;
}

.tableau-ligne {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bordure);
  gap: 12px;
}

.tableau-ligne:last-child { border-bottom: none; }

.rang {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-clair);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tableau-nom { flex: 1; font-weight: 600; font-size: 14px; }
.tableau-sub { font-size: 12px; color: var(--texte-sec); font-weight: 400; }

.tableau-chiffres {
  text-align: right;
  font-size: 13px;
}

.barre-prog-wrap {
  width: 80px;
  background: var(--bordure);
  border-radius: 4px;
  height: 6px;
  flex-shrink: 0;
}

.barre-prog {
  height: 6px;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.5s ease;
}

/* ── Spots ───────────────────────────────────────────────────── */
.carte-spot {
  background: var(--carte);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--ombre);
  border: 1px solid var(--bordure);
}

.spot-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.spot-nom { font-weight: 700; font-size: 16px; }
.spot-riviere { font-size: 13px; color: var(--texte-sec); margin-top: 2px; }

.spot-details {
  font-size: 13px;
  color: var(--texte-sec);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}

/* ── Modale ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.cache { display: none; }

.modal {
  background: var(--carte);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 700px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 20px 40px;
  animation: glisser-haut 0.25s ease;
}

@keyframes glisser-haut {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-titre { font-size: 18px; font-weight: 700; }

.btn-fermer {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--texte-sec);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.btn-fermer:hover { background: var(--accent-clair); color: var(--accent); }

/* ── Formulaires ─────────────────────────────────────────────── */
.groupe {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--texte-sec);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--texte);
  font-size: 15px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

.ligne-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ligne-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── Bouton météo ────────────────────────────────────────────── */
.btn-meteo {
  width: 100%;
  padding: 10px;
  background: var(--accent-clair);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 16px;
  transition: background var(--transition);
}

.btn-meteo:hover { background: var(--accent); color: #fff; }
.btn-meteo:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Section captures dans le formulaire ────────────────────── */
.separateur {
  border: none;
  border-top: 1px solid var(--bordure);
  margin: 20px 0;
}

.captures-form-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.capture-form-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--bordure);
  position: relative;
}

.capture-form-item .btn-retirer {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--texte-sec);
  line-height: 1;
}

.toggle-relache {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--bordure);
}

.toggle-relache button {
  flex: 1;
  padding: 8px;
  border: none;
  background: var(--bg);
  color: var(--texte-sec);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.toggle-relache button.actif {
  background: var(--accent);
  color: #fff;
}

/* ── Boutons principaux ──────────────────────────────────────── */
.btn-primaire {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-primaire:hover { opacity: 0.9; }
.btn-primaire:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondaire {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 10px;
}

.btn-secondaire:hover { background: var(--accent-clair); }

/* ── Message vide ─────────────────────────────────────────────── */
.vide {
  text-align: center;
  padding: 60px 20px;
  color: var(--texte-sec);
}

.vide .icone-vide { font-size: 48px; margin-bottom: 12px; }
.vide p { font-size: 15px; }

/* ── Toast ────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

[data-theme="sombre"] #toast { background: var(--carte); color: var(--texte); border: 1px solid var(--bordure); }

#toast.visible { opacity: 1; }

/* ── Onglet Conditions ────────────────────────────────────────── */

.cartes-jour {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.carte-jour {
  background: var(--carte);
  border-radius: var(--radius);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  border: 2px solid var(--bordure);
  transition: all var(--transition);
  user-select: none;
}

.carte-jour:hover { border-color: var(--accent); }

.carte-jour.actif {
  border-color: var(--accent);
  background: var(--accent-clair);
}

.jour-nom {
  font-size: 11px;
  font-weight: 700;
  color: var(--texte-sec);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.jour-date {
  font-size: 11px;
  color: var(--texte-sec);
  margin-bottom: 8px;
}

.score-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 15px;
  font-weight: 800;
}

.score-vert  { background: #d4f0e4; color: #0e6b4a; }
.score-orange { background: #fde8cc; color: #8a4800; }
.score-rouge  { background: #fde8e8; color: #c0392b; }

[data-theme="sombre"] .score-vert   { background: #1a3d2d; color: #5DCAA5; }
[data-theme="sombre"] .score-orange { background: #3d2a0a; color: #f0a048; }
[data-theme="sombre"] .score-rouge  { background: #3d1a1a; color: #e07070; }

.cond-entete-global {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.fenetres-dorees { display: flex; gap: 8px; flex-wrap: wrap; }

.pill-doree {
  background: #fff8e1;
  color: #7a5200;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #f0d060;
}

[data-theme="sombre"] .pill-doree {
  background: #2a2200;
  color: #f0c040;
  border-color: #5a4400;
}

.score-cercle {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid;
}

.score-cercle.score-vert   { border-color: #0e6b4a; }
.score-cercle.score-orange { border-color: #8a4800; }
.score-cercle.score-rouge  { border-color: #c0392b; }

[data-theme="sombre"] .score-cercle.score-vert   { border-color: #5DCAA5; }
[data-theme="sombre"] .score-cercle.score-orange { border-color: #f0a048; }
[data-theme="sombre"] .score-cercle.score-rouge  { border-color: #e07070; }

.score-chiffre { font-size: 20px; font-weight: 800; line-height: 1; }
.score-dix     { font-size: 11px; font-weight: 600; opacity: 0.65; }

.grille-conditions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.carte-condition {
  background: var(--carte);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid var(--bordure);
  box-shadow: var(--ombre);
}

.cond-haut {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  min-height: 20px;
}

.cond-icone { font-size: 15px; flex-shrink: 0; }

.cond-titre {
  font-size: 11px;
  font-weight: 600;
  color: var(--texte-sec);
  flex: 1;
  line-height: 1.2;
}

.cond-valeur { font-size: 15px; font-weight: 700; }

.badge-eval {
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.eval-ideal    { background: #d4f0e4; color: #0e6b4a; }
.eval-correct  { background: #fde8cc; color: #8a4800; }
.eval-difficile { background: #fde8e8; color: #c0392b; }

[data-theme="sombre"] .eval-ideal     { background: #1a3d2d; color: #5DCAA5; }
[data-theme="sombre"] .eval-correct   { background: #3d2a0a; color: #f0a048; }
[data-theme="sombre"] .eval-difficile { background: #3d1a1a; color: #e07070; }

.timeline-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--bordure) transparent;
}

.timeline-scroll::-webkit-scrollbar { height: 4px; }
.timeline-scroll::-webkit-scrollbar-track { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb { background: var(--bordure); border-radius: 2px; }

.carte-heure {
  flex-shrink: 0;
  width: 62px;
  background: var(--carte);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  border: 2px solid var(--bordure);
  transition: all var(--transition);
}

.carte-heure.meilleure {
  border-color: var(--accent);
  background: var(--accent-clair);
}

.heure-label { font-size: 12px; font-weight: 700; color: var(--texte-sec); margin-bottom: 3px; }
.heure-icone { font-size: 18px; line-height: 1.2; }

.heure-score {
  font-size: 14px;
  font-weight: 800;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto;
}

.heure-vent { font-size: 10px; color: var(--texte-sec); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 400px) {
  .grille-stats { grid-template-columns: 1fr 1fr; }
  .ligne-3 { grid-template-columns: 1fr 1fr; }
  .stat-valeur { font-size: 22px; }
}
