/* IvoireSogo : composants réutilisables */

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn--primary { background: var(--palm); color: #fff; }
.btn--primary:hover { background: var(--palm-dark); color: #fff; }
.btn--outline { background: var(--surface); color: var(--palm); border-color: var(--palm); }
.btn--outline:hover { background: var(--palm-soft); color: var(--palm-dark); }
.btn--quiet { background: transparent; color: var(--slate); }
.btn--quiet:hover { background: var(--palm-soft); color: var(--ink); }

.link-strong { font-weight: 700; }

/* Formulaires */
.search-form {
  display: grid;
  gap: 0.85rem;
}
.field { display: grid; gap: 0.3rem; align-content: start; }
.field label { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #b8c4bb;
  border-radius: var(--radius);
}
.field input:focus,
.field select:focus {
  border-color: var(--palm);
  outline: 3px solid rgba(15, 74, 50, 0.25);
  outline-offset: 0;
}
.search-form__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.search-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.search-form__actions .btn--primary { min-width: 11rem; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 500;
}
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--palm); }

/* Badges de statut */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  border-radius: 999px;
  background: #e8ecea;
  color: #38443c;
}
.card-animal__media .badge {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  box-shadow: 0 0 0 2px var(--surface);
}
.badge--disponible { background: var(--ok-soft); color: var(--ok-ink); }
.badge--en-elevage { background: var(--kola-soft); color: var(--kola-ink); }
.badge--vendu { background: #e8ecea; color: #38443c; }

/* Cartes animaux et fermes : plates, bordées, sans ombre */
.card-animal,
.card-ferme {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.card-animal:hover,
.card-ferme:hover { border-color: var(--palm); }
.card-animal__link,
.card-ferme__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.card-animal__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--palm-soft);
}
.card-animal__media img { width: 100%; height: 100%; object-fit: cover; }
.card-animal__body { display: flex; flex-direction: column; flex: 1; padding: 0.9rem 1rem 1rem; }
.card-animal__title { margin: 0; font-size: 1.2rem; font-weight: 800; }
.card-animal__ref { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--slate); }
.card-animal__line,
.card-ferme__line,
.ferme-box__line {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0 0 0.3rem;
  color: var(--slate);
  font-size: 0.95rem;
}
.card-animal__line .icon,
.card-ferme__line .icon,
.ferme-box__line .icon { margin-top: 0.2rem; color: var(--palm); }
.card-animal__price {
  margin: auto 0 0;
  padding-top: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--palm);
}
.card-ferme__link { padding: 1rem; }
.card-ferme__title { margin-bottom: 0.5rem; font-size: 1.2rem; font-weight: 800; }
.card-ferme__count {
  margin: auto 0 0;
  padding-top: 0.6rem;
  font-weight: 700;
  color: var(--palm);
}

/* Puces de type d'animal (défilement horizontal sur mobile) */
.chips {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0 0 0.35rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.1rem;
  white-space: nowrap;
  font-weight: 700;
  color: var(--palm);
  text-decoration: none;
  background: var(--surface);
  border: 1.5px solid var(--palm);
  border-radius: 999px;
  scroll-snap-align: start;
}
.chip:hover { background: var(--palm); color: #fff; }

/* Pagination */
.pagination { margin-top: 1.75rem; }
.pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pagination__link,
.pagination__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.8rem;
}
.pagination__link {
  font-weight: 700;
  text-decoration: none;
  color: var(--palm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pagination__link:hover { border-color: var(--palm); }
.pagination__link.is-current { background: var(--palm); border-color: var(--palm); color: #fff; }

/* États vides et résumé de résultats */
.empty-state {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--slate);
  background: var(--surface);
  border: 1px dashed #b8c4bb;
  border-radius: var(--radius);
}
.empty-state__title { margin-bottom: 0.4rem; font-weight: 700; color: var(--ink); }
.results-summary { margin-bottom: 1rem; font-weight: 600; color: var(--slate); }
#resultats[aria-busy="true"] { opacity: 0.45; transition: opacity 0.15s; }

/* Fil d'Ariane */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding-top: 1rem;
  font-size: 0.92rem;
}
.breadcrumb a { color: var(--slate); }
.breadcrumb a + a::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--line);
}

/* ---- Stock disponible et contact fermier ---- */
.stock-badge { display: inline-block; margin: 0 0 0.6rem; padding: 0.3rem 0.8rem; border-radius: 999px; background: #e3f4e6; color: #1d6b32; font-size: 0.92rem; font-weight: 600; }
.stock-badge--out { background: #fdecea; color: #a12a1f; }
.card-animal__link > .stock-badge { margin: 0.6rem 0.8rem 0.2rem; }
.animal-tel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.8rem 0 0; font-size: 1.05rem; }
.animal-tel a { color: inherit; }

/* ---- Commande sur la fiche publique ---- */
.order-box { margin-top: 1.2rem; padding: 1rem 1.1rem; border: 1px solid rgba(0,0,0,0.12); border-radius: 14px; background: #fff; }
.order-box:empty { display: none; }
.order-box__title { margin: 0 0 0.6rem; font-size: 1.2rem; }
.order-form { display: grid; gap: 0.8rem; }
.order-form textarea { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid rgba(0,0,0,0.2); border-radius: 10px; font: inherit; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- Installation de l'application (PWA) ---- */
.pwa-install { padding: 0.5rem 1rem; border: 0; border-radius: 999px; background: #f4c21b; color: #2b2200; font: inherit; font-weight: 700; cursor: pointer; }
.pwa-hint { font-size: 0.9rem; opacity: 0.85; }

.show-pwd { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.35rem; font-size: 0.95rem; cursor: pointer; }
.show-pwd input { width: 1.1rem; height: 1.1rem; }

/* ---------- Messages (bandeau, repli sans JavaScript) ---------- */
.alert { margin: 0 0 1rem; padding: 0.8rem 1rem; border: 1px solid transparent; border-radius: 10px; line-height: 1.4; }
.alert__title { display: block; font-size: 1.02rem; }
.alert__text { font-weight: 500; }
.alert-success { color: var(--ok-ink); background: var(--ok-soft); border-color: #b9dfc4; }
.alert-error { color: var(--danger); background: #fbe4e1; border-color: #efb9b3; }
.alert-warning { color: var(--kola-ink); background: var(--kola-soft); border-color: #ecd28c; }
.alert-info { color: #24485a; background: #e6eef0; border-color: #bfd3da; }
.alert--modal { display: none; }

/* ---------- Petite fenêtre de confirmation ---------- */
.flash-lock { overflow: hidden; }
.flash-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 36, 25, 0.55);
  animation: fm-fade 0.18s ease-out;
}
.flash-modal__card {
  width: min(100%, 21rem);
  padding: 1.8rem 1.4rem 1.4rem;
  text-align: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px -20px rgba(7, 36, 25, 0.7);
  animation: fm-pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.flash-modal__icon { display: grid; place-items: center; width: 4.4rem; height: 4.4rem; margin: 0 auto 1rem; border-radius: 50%; }
.flash-modal__icon--success { background: #1f9d55; }
.flash-modal__icon--error { background: #c0392b; }
.flash-modal__icon--warning { background: #d99a00; }
.flash-modal__icon--info { background: #2f6f8f; }
.flash-modal__icon svg { width: 2.4rem; height: 2.4rem; fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.flash-modal__icon path { stroke-dasharray: 64; stroke-dashoffset: 64; animation: fm-draw 0.45s 0.15s ease-out forwards; }
.flash-modal__title { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.3rem; line-height: 1.2; }
.flash-modal__text { margin: 0 0 1.3rem; color: var(--slate); line-height: 1.45; }
.flash-modal__ok { width: 100%; }
@keyframes fm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fm-pop { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: scale(1); } }
@keyframes fm-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .flash-modal, .flash-modal__card { animation: none; }
  .flash-modal__icon path { animation: none; stroke-dashoffset: 0; }
}
