/* style.css – spécifique Guide Harnais
   Le layout global (html, body, .container, header-top, .top-nav, boutons généraux, etc.)
   vient de ../css/style.css à la racine.
*/

/* =========================
   Titre + intro
   ========================= */

h1 {
  text-align: left;
  color: #1f4d4d;
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

/* Intro du guide */
#guide-intro {
  font-size: 0.9rem;
  line-height: 1.4;
  background: #f2fbfb;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

/* =========================
   Formulaire / blocs
   ========================= */

form {
  margin: 0;
}

.blocs-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bloc {
  border-radius: 10px;
  padding: 8px 14px 10px 14px;
  margin-bottom: 4px;
  border: 1px solid rgba(0,0,0,0.05);
}

.bloc legend {
  font-weight: 600;
  padding: 0 6px;
}

.bloc-chiens {
  background: #e8f5e9;
}

.bloc-harnais {
  background: #e3f2fd;
}

.bloc-resultats {
  background: #fff3e0;
}

.bloc-resultats .ligne2-harnais {
  margin-top: 8px;
}

/* Dans ton CSS du guide (style.css local) */

/* Forcer le bloc export sous le résultat, bien séparé du bloc harnais */
.bloc-resultats .ligne2-harnais {
  margin-top: 10px;
  border-top: 1px solid #dde2e7;  /* petite séparation visuelle */
  padding-top: 8px;
}

/* Conteneurs flex génériques */
.form-flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Bloc chiens : 2 lignes indépendantes */

/* Remonter légèrement le label "Sexe" au-dessus des radios */
.ligne1-chiens .xsmall-field:first-child > label {
  margin-bottom: 0;      /* au lieu de 2px via la règle générale */
}

.ligne2-chiens {
  margin-top: 4px;
  align-items: flex-end;
}

/* Champs "compact" génériques */
.compact-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 110px;
  flex: 1;
}

/* tailles relatives des champs */
.xsmall-field {      /* Sexe + champs numériques */
  flex: 0.7;
  max-width: 80px;
}

.large-field {       /* Race */
  flex: 3;
}

/* Valeur par défaut des champs moyens */
.medium-field {
  flex: 1.6;
}

/* Ligne 2 : Morphologie plus étroite, Infos sup plus large */
.ligne2-chiens .compact-field:nth-child(2) {
  /* Morphologie */
  flex: 0.8;
}

.ligne2-chiens .compact-field:nth-child(3) {
  /* Informations supplémentaires */
  flex: 2.1;
}

/* Bloc harnais : petites colonnes pour les boutons, etc. */
.small-field {
  flex: 1;
  max-width: 150px;          /* au lieu de 130px */
}

/* Bloc harnais : 2 lignes comme pour le bloc chiens */
.ligne1-harnais {
  align-items: flex-end;
}

.ligne2-harnais {
  margin-top: 4px;
  align-items: flex-end;
}

/* Bloc harnais plus compact (comme bloc chiens) */
.bloc-harnais .compact-field {
  min-height: 0;             /* au lieu de 90px, supprime la hauteur forcée */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .bloc-harnais .form-flex-wrap {
    align-items: stretch;
  }
  .bloc-harnais .compact-field > *:last-child {
    margin-top: auto;
  }
}

/* Sur écrans étroits, laisser les éléments du bloc harnais passer plus facilement à la ligne */
@media (max-width: 750px) {
  .bloc-harnais .compact-field {
    flex: 1 0 45%;           /* 2 colonnes par ligne max, puis wrap */
    max-width: none;
  }
}

/* =========================
   Labels, inputs, selects, boutons
   ========================= */

label {
  font-size: 0.85rem;
  margin-bottom: 2px;
}

/* Harmoniser visuellement inputs, selects et boutons */
input,
select,
button {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1.6px solid #b4d2d2;
  line-height: 1.3;
  transition: border-color 0.3s ease;
}

select {
  min-width: 130px;
  max-width: 100%;
}

input:focus,
select:focus {
  border-color: #4db8b8;
  outline: none;
}

/* Select des races : un peu plus large si possible */
#raceChien {
  min-width: 230px;
}

/* Select des filtres des races (historique) : un peu plus large si possible */
#raceChien,
#filtre-race {
  min-width: 230px;
}

/* Style spécifique boutons du guide */
button {
  background: #199a9a;
  color: #fff;
  font-weight: 700;
  border: none;
  box-shadow: 0 8px 10px -6px #159292;
  margin-top: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

button:hover {
  background: #137a7a;
}

/* Bouton principal "Calculer" */
.btn-principal {
  font-size: 0.9rem;
  padding: 9.5px 10px;
  line-height: 1.36;
}

/* Boutons secondaires plus bas visuellement */
.btn-secondaire {
  background: #ffffff;
  color: #199a9a;
  border: 1px solid #199a9a;
  box-shadow: none;
  padding: 3px 8px;
  line-height: 1.0;
}

/* Radio sexe */
.radio-sexe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.radio-sexe input[type="radio"] {
  width: auto;
}

/* Ligne marque / modèle + lien fabricant dans le bloc résultat */
.resultat-modele-ligne {
  margin: 4px 0;
  font-size: 0.9rem;
}

#resultat-marque-modele {
  font-weight: 600; /* texte en gras pour marque / modèle */
  margin-right: 6px;
}

#lien-fabricant-selectionne {
  font-weight: 600; /* même graisse que marque/modèle */
  font-size: 0.9rem;
}

.bloc-resultats #resultat-harnais {
  margin-top: 8px;
}

/* =========================
   Résultat + historique
   ========================= */

#resultat {
  background: #dff6f6;
  padding: 8px 10px;
  margin-top: 4px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.25em;
  box-shadow: inset 3px 3px 7px #b5dede,
              inset -3px -3px 7px #f0ffff;
  min-height: 30px;
}

#resultat p {
  margin: 4px 0;
}

#historique {
  background: #f7f8fa;
  padding: 8px 10px;
  margin-top: 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: inset 2px 2px 5px #dde2e7,
              inset -3px -3px 5px #ffffff;
}

/* Chaque entrée d’historique */
.ligne-historique {
  border-bottom: 1px solid #e1e4ea;
  padding: 3px 0;
}

.ligne-historique:last-child {
  border-bottom: none;
}

/* Bloc interne : texte à gauche, vignette à droite */
.hist-bloc {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Le texte prend la largeur restante */
.hist-texte {
  flex: 1;
}

/* Boîte fixe pour toutes les vignettes d'historique */
.hist-vignette {
  width: 120px;
  max-height: 90px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* L'image garde son ratio et reste entièrement visible */
.hist-vignette img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: pointer;
}

/* Anciennes classes (si encore utilisées ailleurs) */
.historique-race {
  font-weight: 600;
}

.historique-mesures {
  font-size: 0.8rem;
  color: #355;
}

.historique-harnais {
  font-size: 0.8rem;
}

/* === Normalisation agressive de la barre de filtres de l'historique === */
#historique-filtres {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-end;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
}

/* On neutralise les contraintes héritées des classes globales dans ce bloc */
#historique-filtres .compact-field {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start;
  flex: 1 1 auto !important;
  min-width: 110px;
  max-width: none !important;
}

/* On annule les éventuels max-width venant de .small-field / .xsmall-field */
#historique-filtres .small-field,
#historique-filtres .xsmall-field {
  flex: 1 1 auto !important;
  max-width: none !important;
}

/* Race = plus large */
#historique-filtres .filtre-race-field {
  flex: 2 1 220px !important;
}

/* Marque et modèle = moyens */
#historique-filtres .filtre-marque-field,
#historique-filtres .filtre-modele-field {
  flex: 1.5 1 180px !important;
}

/* Bouton Réinitialiser = étroit */
#historique-filtres .filtre-reset-field {
  flex: 0 0 110px !important;
}

/* Titre au-dessus des filtres d'historique */
.titre-filtres-historique {
  margin: 6px 0 4px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #455a64;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Texte : prend la place dispo */
.titre-filtres-texte {
  flex: 1 1 auto;
}

/* Conteneur du bouton : taille auto, ne s'étire pas */
.titre-filtres-bouton {
  flex: 0 0 auto;
}

/* Bouton compact malgré .btn-principal */
.btn-clear-hist-inline {
  font-size: 0.85em;
  padding: 0.2em 0.6em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 0 !important;
}


/* =========================
   Tableau du modèle sélectionné
   ========================= */

#tableauxTailles {
  margin-top: 10px;
  background: #f4fbff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

#tableauxTailles h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: #215c7a;
}

#tableau-modele table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

#tableau-modele th,
#tableau-modele td {
  border: 1px solid #c9dfea;
  padding: 4px 6px;
  text-align: center;
}

#tableau-modele th {
  background: #e0f0fb;
}

/* =========================
   Encarts partenaires (version actuelle non utilisée ?)
   ========================= */

#partenaires {
  margin-top: 12px;
  background: #edf9fa;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 0.8rem;
  box-shadow: 0 1px 6px #bde6e6;
}

.partenaire-box {
  flex: 1;
  text-align: center;
  padding: 4px 6px;
  box-sizing: border-box;
}

.partenaire-box h4 {
  margin: 2px 0 4px 0;
  font-size: 0.85rem;
  color: #215c7a;
}

.logo-partenaire {
  max-width: 100%;
  max-height: 60px;
  height: auto;
  display: block;
  margin: 0 auto 4px auto;
}

/* Sur mobile, les encarts passent en colonne */
@media (max-width: 650px) {
  #partenaires {
    flex-direction: column;
  }
}

/* =========================
   Footer spécifique guide
   ========================= */

#site-footer {
  max-width: 90%;
  margin: 10px auto 0 auto;
  padding: 6px 8px;
  font-size: 0.75rem;
  text-align: center;
  color: #456;
}

/* =========================
   Vignette harnais + modal
   ========================= */

/* Conteneur 2 colonnes : lien à gauche, vignette à droite (desktop) */
#fabricant-et-vignette {
  display: grid;
  grid-template-columns: 1fr 140px;  /* texte / vignette */
  align-items: center;
  column-gap: 1rem;
  margin-top: 10px;
}

/* Lien fabricant (h3) dans la colonne de gauche */
#fabricant-harnais h3 {
  margin: 0;
  font-size: 0.95rem;
}

/* Vignette compacte dans la colonne de droite */
.visuel-container {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  background: #fff;
}

/* Image vignette responsive */
#vignette {
  width: 100%;
  height: 100%;
  object-fit: contain;      /* pour voir l’image entière [web:146] */
  object-position: center;
  display: block;           /* évite les petits décalages inline */
}

/* Sur petits écrans : une seule colonne (vignette sous le lien) */
@media (max-width: 700px) {
  #fabricant-et-vignette {
    grid-template-columns: 1fr;
    row-gap: 0.5rem;
  }

  .visuel-container {
    width: 100%;
    max-width: 200px;
  }
}

/* Modal plein écran pour afficher le harnais en grand */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  background: #fff;          /* fond blanc derrière les PNG transparents */
  padding: 6px;              /* petit liseré blanc autour */
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

/* Croix de fermeture du modal */
.modal .close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  font-weight: bold;
}


/* =========================
   Impression spécifique guide
   ========================= */

@media print {
  body {
    background: none;
    padding: 0;
  }
  .header-top,
  #btn-install-pwa,
  #btn-clear-hist,
  #btn-export,
  .top-nav {
    display: none !important;
  }
  .container {
    box-shadow: none;
    border-radius: 0;
    max-width: 100%;
  }
}

/* =========================
   Responsive spécifique guide
   ========================= */

@media (max-width: 650px) {
  .container {
    padding: 10px 3vw;
  }
  .header-top {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .top-nav {
    order: 3;
  }

  /* Sur petits écrans : la race peut prendre toute la ligne si besoin */
  .ligne1-chiens .large-field {
    flex: 1 0 100%;
  }

  /* Fabricant + vignette : empilement vertical si trop étroit */
  #fabricant-harnais {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Ligne marque / modèle / boutons (bloc harnais) ===== */

/* Conteneur spécifique pour aligner marque, modèle et boutons */
.ligne-harnais-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-top: 4px;
}

/* Champs marque / modèle */
.ligne-harnais-actions .champ-marque,
.ligne-harnais-actions .champ-modele {
  flex: 1 1 0;
  min-width: 0;
}

/* Zone boutons compacte */
.ligne-harnais-actions .zone-boutons-harnais {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

/* Boutons réduits dans cette zone */
.ligne-harnais-actions .zone-boutons-harnais .btn-principal,
.ligne-harnais-actions .zone-boutons-harnais .btn-secondaire {
  width: auto;
  padding: 4px 10px;
  font-size: 0.8rem;
  margin-top: 0;
  white-space: nowrap;
}

/* Desktop : tout sur une seule ligne, marque/modèle ≈ 1/3 chacun */
@media (min-width: 900px) {
  .ligne-harnais-actions {
    flex-wrap: nowrap;
  }

  .ligne-harnais-actions .champ-marque,
  .ligne-harnais-actions .champ-modele {
    flex: 0 0 30%;
  }

  .ligne-harnais-actions .zone-boutons-harnais {
    flex: 0 0 auto;
  }
}

/* Mobile : laisser wrap naturellement */
@media (max-width: 899px) {
  .ligne-harnais-actions .champ-marque,
  .ligne-harnais-actions .champ-modele {
    flex: 1 0 45%;
  }
}
