/* ============================================================
   SANTÉ DES PLANTES — Styles principaux
   Mobile-first, très coloré, grandes photos, textes petits
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────────── */
:root {
  --green:       #1a6b32;
  --green-mid:   #2d9b50;
  --green-light: #e6f5eb;
  --green-pale:  #f2faf5;
  --amber:       #e8a020;
  --amber-light: #fff8e8;
  --red:         #c0392b;
  --red-light:   #fdecea;
  --blue:        #1a6fa8;
  --blue-light:  #e6f2fb;
  --earth:       #8b5e3c;
  --earth-light: #f5ece4;
  --purple:      #6b3fa0;
  --purple-light:#f0eafa;
  --gray:        #5c6068;
  --gray-light:  #f4f5f7;
  --border:      #e2e6ea;
  --text:        #1a1d23;
  --text-muted:  #6b7280;
  --white:       #ffffff;
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --shadow:      0 2px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.14);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--gray-light);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

img { display: block; max-width: 100%; height: auto; }
a   { color: var(--green); text-decoration: none; }

/* ── App Shell ─────────────────────────────────────────────── */
.app-header {
  background: var(--green);
  color: var(--white);
  padding: 0 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.app-header-inner {
  max-width: 960px; margin: 0 auto;
  height: 58px;
  display: flex; align-items: center; gap: 12px;
}
.app-logo {
  font-size: 28px; line-height: 1;
}
.app-title { font-size: 20px; font-weight: 800; letter-spacing:.02em; }
.app-subtitle { font-size: 11px; opacity: .8; }
.header-search-btn {
  background: rgba(255,255,255,.2);
  border: none; color: #fff; width: 40px; height: 40px;
  border-radius: 50%; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.header-search-btn:hover { background: rgba(255,255,255,.35); }

/* ── Barre de recherche ────────────────────────────────────── */
.search-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5);
  align-items: flex-start;
  padding-top: 70px;
}
.search-overlay.open { display: flex; }
.search-box {
  background: #fff; width: 92%; max-width: 600px;
  margin: 0 auto; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.search-input {
  width: 100%; padding: 16px 18px;
  font-size: 17px; border: none; outline: none;
  border-bottom: 1px solid var(--border);
}
.search-results { max-height: 60vh; overflow-y: auto; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: background .15s;
}
.search-result-item:hover { background: var(--gray-light); }
.search-result-item img {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.search-result-meta { font-size: 12px; color: var(--text-muted); }

/* ── Navigation principale ─────────────────────────────────── */
.main-nav {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  position: sticky; top: 58px; z-index: 90;
}
.main-nav-inner {
  display: flex; max-width: 960px; margin: 0 auto;
}
.nav-tab {
  flex: 1; min-width: 70px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 10px 8px;
  border: none; background: none; cursor: pointer;
  font-size: 11px; color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
.nav-tab .nav-icon { font-size: 22px; }
.nav-tab.active { color: var(--green); border-bottom-color: var(--green); }
.nav-tab:hover  { color: var(--green-mid); }

/* ── Contenu principal ─────────────────────────────────────── */
.main-content {
  max-width: 960px; margin: 0 auto; padding: 16px;
}

/* ── Section Titre ─────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 15px; font-weight: 700;
  color: var(--green); display: flex; align-items: center; gap: 6px;
}
.section-title .icon { font-size: 18px; }
.see-all-link { font-size: 12px; color: var(--blue); }

/* ═══════════════════════════════════════════════════════════
   CARTES — GRANDES, PHOTOS DOMINANTES
   ═══════════════════════════════════════════════════════════ */

/* ── Grille auto-responsive ────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
@media (min-width: 640px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 960px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ── Carte standard (photo + texte court) ──────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card-photo {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--gray-light);
}
.card-photo-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--green-light), var(--green-pale));
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
}
.card-body {
  padding: 10px 12px 12px;
}
.card-name {
  font-size: 14px; font-weight: 700; line-height: 1.3;
  color: var(--text); margin-bottom: 2px;
}
.card-local {
  font-size: 11px; color: var(--text-muted); font-style: italic;
  margin-bottom: 6px;
}
.card-badges {
  display: flex; flex-wrap: wrap; gap: 4px;
}

/* Badge coloré */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-green    { background: var(--green-light); color: var(--green); }
.badge-amber    { background: var(--amber-light); color: #8a5a00; }
.badge-red      { background: var(--red-light);   color: var(--red); }
.badge-blue     { background: var(--blue-light);  color: var(--blue); }
.badge-earth    { background: var(--earth-light); color: var(--earth); }
.badge-purple   { background: var(--purple-light);color: var(--purple); }
.badge-success  { background: #e6f5eb; color: #1a6b32; }
.badge-warning  { background: #fff8e8; color: #8a5a00; }
.badge-danger   { background: var(--red-light);   color: var(--red); }
.badge-critical { background: #3d0000; color: #ff8888; }

/* Pastille vues */
.card-views {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  backdrop-filter: blur(4px);
}

/* ── Carte large (liste) ───────────────────────────────────── */
.card-wide {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; overflow: hidden;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  margin-bottom: 12px;
}
.card-wide:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-wide-photo {
  width: 120px; min-width: 120px; object-fit: cover;
}
@media (min-width: 640px) { .card-wide-photo { width: 160px; min-width: 160px; } }
.card-wide-body { padding: 14px 16px; flex: 1; }
.card-wide-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card-wide-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.card-wide-meta  { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Bande de couleur gravité à gauche */
.card-wide.gravite-faible   { border-left: 5px solid #2d9b50; }
.card-wide.gravite-moyen    { border-left: 5px solid var(--amber); }
.card-wide.gravite-élevé    { border-left: 5px solid var(--red); }
.card-wide.gravite-critique { border-left: 5px solid #7b0000; }

/* ═══════════════════════════════════════════════════════════
   FICHE DÉTAIL — GRANDE PAGE PHOTO
   ═══════════════════════════════════════════════════════════ */

.detail-hero {
  position: relative;
  width: 100%; aspect-ratio: 16/9;
  background: var(--gray-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.detail-hero img {
  width: 100%; height: 100%; object-fit: cover;
}
.detail-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 55%);
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}
.detail-hero-title {
  font-size: 24px; font-weight: 800;
  color: #fff; line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.detail-hero-local {
  font-size: 13px; color: rgba(255,255,255,.85);
  font-style: italic; margin-top: 4px;
}

/* Photos secondaires */
.photos-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
  gap: 10px; margin-bottom: 20px;
}
.photos-row img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: var(--radius-sm); cursor: pointer;
}

/* Bouton audio */
.audio-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--green);
  color: #fff; border: none;
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  width: 100%; margin-bottom: 20px;
  transition: background .2s;
  box-shadow: var(--shadow);
}
.audio-btn:hover { background: var(--green-mid); }
.audio-btn .audio-icon { font-size: 28px; }
.audio-btn.playing { background: var(--blue); }

/* Blocs d'information */
.info-block {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.info-block-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.info-block-title .icon { font-size: 16px; }
.info-block p { font-size: 14px; line-height: 1.7; }

/* Gravité visuelle */
.gravite-bar {
  height: 8px; border-radius: 4px; background: var(--border);
  overflow: hidden; margin-top: 6px;
}
.gravite-fill { height: 100%; border-radius: 4px; }

/* Étapes de préparation */
.steps-list { list-style: none; }
.steps-list li {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.steps-list li:last-child { border-bottom: none; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-text { font-size: 14px; line-height: 1.6; }

/* Cartes solutions liées */
.solutions-list { display: grid; gap: 12px; }
.solution-link-card {
  background: var(--green-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-decoration: none;
  transition: background .2s;
}
.solution-link-card:hover { background: var(--green-pale); }
.solution-link-card img {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.solution-link-name { font-size: 14px; font-weight: 700; color: var(--green); }
.solution-link-type { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.efficacite-stars   { color: var(--amber); font-size: 13px; margin-top: 4px; }

/* Plantes liées (chips) */
.plantes-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.plante-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
  font-size: 12px; cursor: pointer;
  transition: border-color .2s;
  text-decoration: none; color: var(--text);
}
.plante-chip:hover { border-color: var(--green); color: var(--green); }
.plante-chip img {
  width: 32px; height: 32px; object-fit: cover; border-radius: 6px;
}

/* Lightbox photo */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.92);
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-close {
  position: fixed; top: 16px; right: 16px;
  background: rgba(255,255,255,.2); color: #fff;
  border: none; border-radius: 50%;
  width: 44px; height: 44px; font-size: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ── Filtre catégories ─────────────────────────────────────── */
.cat-filter {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 6px; margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.cat-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 20px; font-size: 13px;
  border: 2px solid var(--border); background: var(--white);
  white-space: nowrap; cursor: pointer;
  transition: all .2s;
}
.cat-chip.active {
  background: var(--green); border-color: var(--green); color: #fff;
}
.cat-chip:hover:not(.active) { border-color: var(--green); color: var(--green); }


/* ═══════════════════════════════════════════════════════════
   GRILLE DE CARTES — responsive (3 col mobile → auto desktop)
   ═══════════════════════════════════════════════════════════ */

/* Grille : 3 colonnes fixes sur mobile, auto-fill sur desktop */
.h-scroll-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 3 colonnes sur mobile */
  gap: 10px;
  padding: 4px 0 16px;
}
@media (min-width: 540px) {
  .h-scroll-wrap { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}
@media (min-width: 768px) {
  .h-scroll-wrap { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}
@media (min-width: 1024px) {
  .h-scroll-wrap { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
}

/* Carte */
.h-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.h-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* Photo carrée (ratio 1:1) */
.h-card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.h-card-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: var(--green-light);
}
@media (min-width: 480px) { .h-card-placeholder { font-size: 48px; } }

/* Corps */
.h-card-body {
  padding: 8px 10px 10px;
  flex: 1;
}
.h-card-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 480px) { .h-card-name { font-size: 13px; } }
.h-card-local {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 480px) { .h-card-local { font-size: 11px; } }
.h-card-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--gray-light);
  padding: 2px 6px;
  border-radius: 10px;
  margin-top: 3px;
}

/* Commutateur de langue */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.lang-btn {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.3);
  transition: all .2s;
  letter-spacing: .04em;
}
.lang-btn.active { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.6); }
.lang-btn:hover:not(.active) { color: #fff; }

/* ── Retour ─────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--green);
  background: var(--green-light);
  padding: 8px 14px; border-radius: var(--radius);
  border: none; cursor: pointer;
  margin-bottom: 16px;
  text-decoration: none;
}

/* ── Loader ─────────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 12px 22px; border-radius: var(--radius);
  font-size: 14px; z-index: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Responsive fine-tuning ─────────────────────────────────── */
@media (max-width: 400px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail-hero-title { font-size: 20px; }
}
@media (min-width: 960px) {
  .main-content { padding: 24px 20px; }
  .detail-hero  { aspect-ratio: 21/9; }
  .cards-grid   { gap: 18px; }
}

/* ============================================================
   CARROUSEL DE PHOTOS — avec légendes et flèches
   ============================================================ */

.carousel-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

/* Piste de slides */
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  position: relative;
  height: 100%;
}

.carousel-slide img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

/* Légende en bas */
.carousel-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff;
  padding: 32px 16px 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  letter-spacing: .01em;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
  min-height: 48px;
}

/* Flèches nav */
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.88);
  border: none; border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: background .2s, transform .2s;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.carousel-btn:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-btn:disabled { opacity: .3; cursor: default; }

/* Pastilles indicateurs */
.carousel-dots {
  position: absolute; bottom: 38px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 10;
}
.carousel-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.5); border: none; cursor: pointer;
  transition: background .2s, transform .2s;
  padding: 0;
}
.carousel-dot.active {
  background: #fff; transform: scale(1.25);
}

/* Compteur */
.carousel-counter {
  position: absolute; top: 10px; right: 12px;
  background: rgba(0,0,0,.5); color: #fff;
  font-size: 11px; padding: 3px 9px;
  border-radius: 12px; backdrop-filter: blur(4px);
  z-index: 10;
}

/* Placeholder si aucune photo */
.carousel-empty {
  width: 100%; aspect-ratio: 16/9;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

/* ── Lien retour home dans le header ─── */
.app-header-link {
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: inherit; flex: 1;
}
.app-header-link:hover .app-title { opacity: .85; }

/* ── Lecteur audio intégré ───────────────────────────────── */
.audio-player-wrap {
  background: var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.audio-player-label {
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.8);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.audio-player-wrap audio {
  width: 100%; height: 40px;
  border-radius: 8px;
  accent-color: #fff;
}
/* Style audio pour fond vert */
.audio-player-wrap audio::-webkit-media-controls-panel { background: rgba(255,255,255,.15); }

/* ── Contenu riche (HTML depuis éditeur) ── */
.rich-content { font-size: 14px; line-height: 1.75; }
.rich-content p  { margin-bottom: 8px; }
.rich-content ul, .rich-content ol { padding-left: 20px; margin-bottom: 8px; }
.rich-content li { margin-bottom: 4px; }
.rich-content strong { font-weight: 700; }
.rich-content em     { font-style: italic; }
.rich-content u      { text-decoration: underline; }

/* Fond jaune highlight */
.rich-content mark { background: #fff59d; padding: 1px 3px; border-radius: 3px; }
