/* =====================================================
   PestManager Pro — Styles globaux
   Mobile-first : conçu d'abord pour smartphone terrain
   ===================================================== */
:root {
  --vert: #1b7a43;          /* couleur principale (métier hygiène/3D) */
  --vert-fonce: #14562f;
  --vert-clair: #e6f4ec;
  --rouge: #c0392b;
  --gris-fond: #f4f6f5;
  --gris-texte: #4a5550;
  --noir: #1c2320;
  --blanc: #ffffff;
  --radius: 10px;
  --ombre: 0 2px 10px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--gris-fond);
  color: var(--noir);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ----- Écrans d'authentification ----- */
.ecran-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.25rem;
}

.logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--vert);
  margin-bottom: 0.25rem;
}
.logo span { color: var(--noir); }

.slogan {
  color: var(--gris-texte);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.carte {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
}

.carte h1 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

/* ----- Formulaires ----- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gris-texte);
  margin: 0.9rem 0 0.3rem;
}

input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;             /* évite le zoom auto iOS */
  border: 1px solid #d4dcd8;
  border-radius: var(--radius);
  background: var(--blanc);
}
input:focus {
  outline: 2px solid var(--vert);
  border-color: transparent;
}

.bouton {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blanc);
  background: var(--vert);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 48px;            /* cible tactile confortable */
}
.bouton:hover { background: var(--vert-fonce); }
.bouton:disabled { opacity: 0.6; cursor: wait; }

/* ----- Messages ----- */
.message {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: none;               /* affiché via JS */
}
.message.erreur  { display: block; background: #fdecea; color: var(--rouge); }
.message.succes  { display: block; background: var(--vert-clair); color: var(--vert-fonce); }

/* ----- Liens ----- */
.liens-auth {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.9rem;
}
.liens-auth a { color: var(--vert); text-decoration: none; font-weight: 600; }
.liens-auth a:hover { text-decoration: underline; }
.liens-auth p + p { margin-top: 0.5rem; }

/* Écrans plus larges (tablette / bureau) */
@media (min-width: 600px) {
  .carte { padding: 2rem; }
}

/* =====================================================
   Tableau de bord
   ===================================================== */
.barre-nav {
  background: var(--blanc);
  box-shadow: var(--ombre);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.barre-nav .logo { font-size: 1.1rem; margin: 0; }

.bouton-lien {
  background: none;
  border: none;
  color: var(--gris-texte);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
}
.bouton-lien:hover { color: var(--rouge); }

.contenu {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.contenu h1 { font-size: 1.25rem; margin: 0.5rem 0 1rem; }
.contenu h2 { font-size: 1rem; margin: 1.5rem 0 0.75rem; color: var(--gris-texte); }

/* Cartes de statistiques */
.grille-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.carte-stat {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 1rem;
}
.carte-stat .chiffre {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--vert);
}
.carte-stat .chiffre.alerte { color: var(--rouge); }
.carte-stat .libelle {
  font-size: 0.8rem;
  color: var(--gris-texte);
  margin-top: 0.2rem;
}

/* Alertes */
.alerte-item {
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.alerte-item.urgent    { background: #fdecea; color: var(--rouge); }
.alerte-item.important { background: #fef5e7; color: #9a6700; }
.alerte-item.info      { background: var(--vert-clair); color: var(--vert-fonce); }

/* Liste d'interventions */
.liste-cartes { display: flex; flex-direction: column; gap: 0.5rem; }
.carte-ligne {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.carte-ligne .heure {
  font-weight: 700;
  color: var(--vert);
  min-width: 3.2rem;
}
.carte-ligne .details { flex: 1; }
.carte-ligne .titre { font-weight: 600; font-size: 0.95rem; }
.carte-ligne .sous-titre { font-size: 0.8rem; color: var(--gris-texte); }

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.planifiee { background: #e8f0fe; color: #1a56b0; }
.badge.en_cours  { background: #fef5e7; color: #9a6700; }
.badge.terminee  { background: var(--vert-clair); color: var(--vert-fonce); }

.vide {
  text-align: center;
  color: var(--gris-texte);
  font-size: 0.9rem;
  padding: 1.5rem;
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
}

@media (min-width: 700px) {
  .grille-stats { grid-template-columns: repeat(4, 1fr); }
}

/* =====================================================
   Navigation par onglets + page Clients
   ===================================================== */
.onglets {
  display: flex;
  gap: 0.25rem;
  background: var(--blanc);
  padding: 0 0.5rem;
  box-shadow: var(--ombre);
  overflow-x: auto;
}
.onglets a {
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gris-texte);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.onglets a.actif { color: var(--vert); border-bottom-color: var(--vert); }

.barre-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.barre-actions input[type="search"] {
  flex: 1;
  min-width: 150px;
}
.barre-actions select {
  padding: 0.6rem;
  border: 1px solid #d4dcd8;
  border-radius: var(--radius);
  background: var(--blanc);
  font-size: 0.9rem;
}
.bouton-principal {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blanc);
  background: var(--vert);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 44px;
}
.bouton-principal:hover { background: var(--vert-fonce); }

.pastille-type {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--vert-clair);
  color: var(--vert-fonce);
  white-space: nowrap;
}

/* Fenêtre modale (formulaire client) */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-end;          /* mobile : glisse du bas */
  justify-content: center;
  z-index: 50;
}
.voile.ouvert { display: flex; }
.modale {
  background: var(--blanc);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modale h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.modale .rangee { display: flex; gap: 0.6rem; }
.modale .rangee > div { flex: 1; }
.actions-modale { display: flex; gap: 0.6rem; margin-top: 1.2rem; }
.actions-modale .bouton { margin-top: 0; }
.bouton.secondaire { background: #e4e9e6; color: var(--noir); }
.bouton.secondaire:hover { background: #d4dcd8; }

@media (min-width: 600px) {
  .voile { align-items: center; }
  .modale { border-radius: var(--radius); }
}

/* =====================================================
   Page Interventions : fiche, photos, signature
   ===================================================== */
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #d4dcd8;
  border-radius: var(--radius);
  background: var(--blanc);
  min-height: 80px;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--vert); border-color: transparent; }

select.champ {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d4dcd8;
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--blanc);
}

.badge.annulee { background: #eeeeee; color: #666; }

/* Galerie de photos */
.galerie {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.galerie .vignette {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gris-fond);
}
.galerie .vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.galerie .vignette button {
  position: absolute;
  top: 2px;
  right: 2px;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
}

/* Zone de signature (canvas) */
.zone-signature {
  border: 2px dashed #c3cec8;
  border-radius: var(--radius);
  background: var(--blanc);
  touch-action: none;          /* indispensable pour dessiner au doigt */
  width: 100%;
  height: 160px;
  display: block;
}
.signature-faite {
  border: 1px solid #d4dcd8;
  border-radius: var(--radius);
  background: var(--blanc);
  max-width: 100%;
}

.actions-fiche {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
.actions-fiche .bouton-principal { flex: 1; min-width: 130px; }
.bouton-principal.orange { background: #b97700; }
.bouton-principal.orange:hover { background: #9a6700; }
.bouton-principal.rouge { background: var(--rouge); }
.bouton-principal.rouge:hover { background: #992d22; }
.bouton-principal.neutre { background: #e4e9e6; color: var(--noir); }

/* =====================================================
   Page Abonnement
   ===================================================== */
.grille-plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.carte-plan {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 1.25rem;
  border: 2px solid transparent;
  text-align: center;
}
.carte-plan.actuel { border-color: var(--vert); }
.carte-plan .nom-plan { font-weight: 700; font-size: 1.05rem; }
.carte-plan .prix { font-size: 2rem; font-weight: 700; color: var(--vert); margin: 0.4rem 0; }
.carte-plan .prix small { font-size: 0.85rem; color: var(--gris-texte); font-weight: 400; }
.carte-plan .description-plan { font-size: 0.85rem; color: var(--gris-texte); margin-bottom: 0.9rem; }
.etiquette-actuel {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--vert-fonce);
  background: var(--vert-clair);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 700px) {
  .grille-plans { grid-template-columns: repeat(3, 1fr); }
}
