/* Style.css racine - commun à l'accueil et aux applis */

/* ----------------- Base typographie + layout ----------------- */

/* Taille de base un peu réduite pour tout le site */
html {
  font-size: 15px;
}

/* Option : encore un peu plus petit uniquement dans l'appli installée (PWA standalone) */
@media (display-mode: standalone) {
  html {
    font-size: 14px;
  }
}

body {
  background: linear-gradient(135deg, #cce7e7, #85bcbf);
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #264d4d;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 15px 8px;
}

/* Carte blanche principale qui contient chaque page */
.container {
  background: white;
  border-radius: 15px;
  padding: 18px 20px 24px 20px;
  max-width: 950px;
  min-width: 320px;
  width: 100%;
  box-shadow: 9px 9px 20px #759292,
              -9px -9px 20px #dbffff;
  box-sizing: border-box;
}

h1 {
  text-align: center;
  color: #1f4d4d;
  margin-bottom: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.3rem;
  }
}

/* ----------------- Formulaires génériques (calculateur, etc.) ----------------- */

.form-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 160px;
  max-width: none;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

/* Petits blocs (pneus, etc.) */
.form-group-small {
  flex: 1;
  min-width: 150px;
  max-width: 230px;
}

input,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 0.95rem;
  border: 1.6px solid #b4d2d2;
  border-radius: 8px;
  transition: border-color 0.3s ease;
}

select {
  min-width: 140px;
  max-width: 100%;
}

input:focus,
select:focus {
  border-color: #4db8b8;
  outline: none;
}

button {
  width: 100%;
  padding: 10px;
  margin-top: 14px;
  background: #199a9a;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 10px -6px #159292;
  transition: background 0.3s ease;
}

button:hover {
  background: #137a7a;
}

/* Ligne d’actions : Calculer + Imprimer sur une ligne, petits boutons */
.actions-ligne {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Boutons secondaires génériques (Aide, Export, etc.) */
.btn-secondaire {
  width: auto;
  padding: 6px 10px;
  font-size: 0.9rem;
  margin-top: 0;
  box-shadow: none;
  background: #ffffff;
  color: #199a9a;
  border: 1px solid #199a9a;
}

/* ----------------- Résultat + historique du calculateur ----------------- */

#resultat {
  background: #dff6f6;
  padding: 8px 12px;
  margin-top: 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.25em;
  box-shadow: inset 3px 3px 7px #b5dede,
              inset -3px -3px 7px #f0ffff;
  white-space: normal;
}

#resultat p {
  margin: 4px 0;
}

#history {
  background: #d7eeef;
  padding: 12px 16px;
  border-radius: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.3em;
  max-height: 150px;
  overflow-y: auto;
  box-shadow: inset 2px 2px 5px #a8d7d7,
              inset -2px -2px 5px #efffff;
}

.verdict-safe { color: #2e7d32; font-weight: 700; }
.verdict-warning { color: #ff9800; font-weight: 700; }
.verdict-danger { color: #d32f2f; font-weight: 700; }

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 8px;
}

.history-header h2 {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  color: #226d68;
}

.history-header button {
  width: auto;
  padding: 6px 14px;
  font-size: 0.9rem;
  margin-left: 12px;
  box-shadow: none;
  border-radius: 6px;
}

/* ----------------- Zone graphismes / sponsors (commune) ----------------- */

#graphique {
  margin: 10px 0 0 0;
  min-height: 70px;
  width: 100%;
  background: #edf9fa;
  border-radius: 10px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  color: #226d68;
  font-size: 0.85em;
  box-shadow: 0 1px 6px #bde6e6;
  overflow: hidden;
}

.graph-slot {
  flex: 1;
  padding: 6px 8px;
  box-sizing: border-box;
  text-align: center;
  border-right: 1px solid #d0ecef;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.graph-slot:last-child {
  border-right: none;
}

.graph-slot strong {
  display: block;
  margin-bottom: 2px;
}

.graph-slot span {
  font-size: 0.8em;
}

/* Logos des partenaires / clubs / fabricants */
.logo-sponsor {
  max-width: 100%;
  max-height: 120px;
  height: auto;
  display: block;
  cursor: pointer;
}

/* Modal d'affichage grand format pour les logos */
.logo-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
}

.logo-modal.open {
  display: flex;
}

.logo-modal img {
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 0 15px #000;
  border-radius: 8px;
  background: #fff;
}

.logo-modal-close {
  position: fixed;
  top: 12px;
  right: 18px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

/* ----------------- Bloc formule (calculateur) ----------------- */

#formule {
  margin-top: 18px;
  max-width: 730px;
  margin-left: auto;
  margin-right: auto;
  padding: 12px 10px;
  background: #fefefe;
  border-radius: 14px;
  box-shadow: 0 2px 10px #aacaca;
  color: #236f6f;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: justify;
}

#formule h3 {
  text-align: center;
  margin-bottom: 16px;
  font-weight: 700;
  color: #1f5858;
}

#formula-mjx {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 10px;
  padding: 6px;
  color: #114477;
  background: #f2faff;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
  max-width: 95%;
}

/* ----------------- Blocs colorés génériques (calculateur) ----------------- */

.bloc {
  border-radius: 10px;
  padding: 8px 14px 10px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.05);
}

.bloc legend {
  font-weight: 600;
  padding: 0 6px;
}

.bloc-velo {
  background: #e3f2fd;
}

.bloc-trajet {
  background: #fff3e0;
}

.bloc-chiens {
  background: #e8f5e9;
}

/* Petit ? d'info */
.info {
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 4px;
  cursor: help;
  border-radius: 50%;
  border: 1px solid #777;
  padding: 0 4px;
  display: inline-block;
  line-height: 1rem;
}

/* ----------------- En-tête + navigation commune ----------------- */

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.header-top h1 {
  margin: 0;
  flex: 1 0 auto;
}

/* Groupe de boutons à droite du header (install + aide) */
.header-actions {
  display: flex;
  gap: 6px;
}

/* Bouton install du pack (PWA) */
.install-btn {
  position: relative;
  width: auto;
  padding: 6px 10px;
  font-size: 0.8rem;
  margin-top: 0;
  background: #199a9a;
  border-radius: 8px;
  box-shadow: none;
}

/* Bouton pack (visible mais piloté par JS) */
#btn-install-pack {
  display: inline-flex;
}

/* Infobulle au survol */
.install-tooltip {
  position: absolute;
  right: 0;
  top: 120%;
  max-width: 260px;
  background: #004d40;
  color: #fff;
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.header-top:hover .install-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.install-info {
  margin-left: 4px;
  font-weight: 700;
}

/* Menu de navigation commun (si utilisé sur sous-pages) */
.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.top-nav .nav-link {
  text-decoration: none;
  text-align: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: #d7eeef;
  color: #264d4d;
}

.top-nav .nav-link:hover {
  background: #bcdfe1;
}

/* Footer inclus (marges gauche/droite) */
#site-footer {
  max-width: 90%;
  margin: 10px auto 0 auto;
  padding: 6px 8px;
  font-size: 0.75rem;
  text-align: center;
}

/* ----------------- Accueil : cartes, intro, publics, infos techniques ----------------- */

/* Intro accueil : bloc texte sous les cartes, encadré bleu */
#intro-accueil {
  text-align: left;
  margin-bottom: 22px;
  background: #e3f2fd;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 0.9rem;      /* police un peu plus petite sur l'accueil */
  line-height: 1.5;
}

#intro-accueil h2 {
  margin: 0 0 8px 0;
  font-size: 1.15rem;     /* plus petit que h1, mais lisible */
  color: #1f4d4d;
}

#intro-accueil p {
  margin: 4px 0;
  text-align: justify;
}

/* Grille des deux applis sur l'accueil */
#apps-accueil {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  margin: 10px 0 18px 0;
}

/* Cartes vers les 2 applis (version compacte) */
.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #264d4d;
  padding: 14px 14px 16px 14px;
  background: #f8ffff;
  border-radius: 14px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.25s;
  border: 2px solid transparent;
  margin: 4px 0;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
  border-color: #199a9a;
}

/* Visuel principal de chaque carte (photo) */
.app-hero {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 8px;
}

/* Petit logo applicatif sous la photo */
.app-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
}

/* Titres + textes des cartes */
.app-card h2 {
  margin: 6px 0 4px 0;
  font-size: 1.05rem;
  color: #1f4d4d;
  text-align: center;
}

.app-card p {
  margin: 0;
  color: #456;
  font-size: 0.85rem;
  text-align: center;
}

/* Bouton type lien dans les cartes d'accueil */
.app-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #199a9a;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.app-card:hover .app-link {
  background: #137a7a;
}

/* Bloc publics concernés */
#publics-accueil {
  margin-top: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #e8f5e9;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

#publics-accueil h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  color: #226d68;
}

#publics-accueil ul {
  padding-left: 18px;
  margin: 0;
}

#publics-accueil li {
  margin-bottom: 3px;
}

/* Bloc infos techniques */
#infos-techniques {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f4fbff;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

#infos-techniques h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  color: #215c7a;
}

#infos-techniques ul {
  padding-left: 18px;
  margin: 0;
}

#infos-techniques li {
  margin-bottom: 4px;
}

/* ----------------- Responsive ----------------- */

/* Smartphones uniquement : cartes vraiment réduites */
@media (max-width: 650px) {
  .form-row {
    flex-direction: column;
    gap: 4px;
  }

  .container {
    padding: 10px 3vw;
  }

  #formule {
    padding: 8px 2vw;
  }

  #resultat,
  #history {
    padding: 10px 3vw;
  }

  #graphique {
    flex-direction: column;
  }

  .graph-slot {
    border-right: none;
    border-bottom: 1px solid #d0ecef;
  }

  .graph-slot:last-child {
    border-bottom: none;
  }

  /* Accueil : intro + blocs texte légèrement réduits */
  #intro-accueil,
  #publics-accueil,
  #infos-techniques {
    font-size: 0.85rem;
  }

  #intro-accueil h2 {
    font-size: 1.05rem;
  }

  #publics-accueil h3,
  #infos-techniques h3 {
    font-size: 0.95rem;
  }

  #apps-accueil {
    gap: 10px;
  }

  /* >>> CARTES ACCUEIL SMARTPHONE (taille ~÷2) <<< */
  .app-card {
    padding: 6px 8px 8px 8px;
    max-width: 200px;
    width: 75%;
    margin: 4px auto;
  }

  .app-hero {
    width: 100%;
    max-width: 200px;
    max-height: 90px;
    height: auto;
    object-fit: contain;
    margin-bottom: 4px;
  }

  .app-logo {
    width: 38px;
    height: 38px;
    margin-bottom: 3px;
  }

  .app-card h2 {
    font-size: 0.85rem;
    margin: 3px 0 2px 0;
  }

  .app-card p {
    font-size: 0.75rem;
  }

  .app-link {
    margin-top: 4px;
    padding: 4px 7px;
    font-size: 0.75rem;
  }
}

/* ----------------- Impression ----------------- */

@media print {
  body {
    background: none;
  }
  .header-top,
  #graphique,
  #formule,
  button,
  .history-header {
    display: none !important;
  }
  #resultat,
  #history {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  #site-footer {
    margin-top: 10px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    padding: 6px 8px;
    font-size: 0.75rem;
    border-radius: 10px;
  }
}
