/* =========================================
   Thème
   ========================================= */
:root{
  --primary:#0e3a22;
  --primary-500:#1f6b3e;
  --primary-600:#155a35;
  --primary-700:#0a3e23;

  --primary-200:#cfe7da;
  --primary-140:#d7ebe2;
  --primary-120:#dfeae4;
  --primary-100:#e9f2ec;
  --primary-050:#f6fbf8;

  --surface:#ffffff;
  --surface-alt:#fafdfb;

  --text:#223029;
  --muted:#5f6e66;
  --danger:#d64545;

  --shadow-1:0 10px 22px rgba(16,84,47,.10);
  --shadow-2:0 16px 34px rgba(16,84,47,.16);

  --radius-xl:22px;
  --radius-lg:16px;
  --radius-md:12px;
  --radius-sm:10px;
}

/* Sécurité overflow */
html, body{ overflow-x:hidden; }
*{ box-sizing:border-box; max-width:100%; }

/* =========================================
   Titres & souligné
   ========================================= */
#location-info-title-text,
.Home-location-title-text,
.specification-title-text{
  margin-top:48px;
  margin-left:0;
  font-weight:800;
  font-size:clamp(20px,2.1vw,28px);
  color:var(--text);
  position:relative;
  z-index:1;
  text-align:left;
}

#location-info-title-background-image,
.Home-location-title-background-image,
.specification-title-background-image{ display:none; }

.title-underline{
  display:block;
  width:140px; height:12px; border-radius:999px;
  background:linear-gradient(90deg,var(--primary),var(--primary-600),#6ccf6a);
  box-shadow:0 4px 12px rgba(16,84,47,.18);
  margin:8px 0 16px 0;
}

/* =========================================
   Bouton générique
   ========================================= */
.custom-button{
  position:relative;
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  background:linear-gradient(180deg,var(--primary-600),var(--primary));
  color:#fff;
  border:1px solid var(--primary-600);
  padding:12px 16px;
  margin:10px 0;
  border-radius:14px;
  font-size:1rem;
  font-weight:800;
  cursor:pointer;
  outline:none;
  text-decoration:none;
  box-shadow:0 8px 18px rgba(16,84,47,.18);
  transition:transform .15s ease, box-shadow .22s ease, filter .2s ease, background .2s ease;
}
.custom-button, .custom-button *{ color:#ffffff !important; }
.custom-button:hover{ transform:translateY(-1px); box-shadow:0 14px 26px rgba(16,84,47,.24); filter:saturate(1.05); }
.custom-button:active{ transform:translateY(0); }

/* =========================================
   Détails machine
   ========================================= */
.machine-details{
  display:grid;
  grid-template-columns:minmax(280px,470px) 1fr;
  gap:34px;
  align-items:start;
}

.machine-img-container{
  background:var(--surface);
  width:100%; height:470px;
  display:flex; justify-content:center; align-items:center;
  border:1px solid var(--primary-120);
  border-radius:var(--radius-xl);
  padding:12px;
  overflow:hidden;
  box-shadow:var(--shadow-1);
  transition:transform .2s ease, box-shadow .25s ease;
}
.machine-img-container:hover{ transform:translateY(-2px); box-shadow:var(--shadow-2); }

.machine-details img{
  width:100%; height:100%;
  object-fit:contain;
  border-radius:12px;
}

.machine-info{ margin-left:0; }

.machine-specifications{
  font-style:italic;
  font-size:15px;
  color:var(--primary-600);
  margin-top:6px;
}

.machine-nom{
  font-weight:900;
  font-size:clamp(22px,2.4vw,32px);
  margin-top:8px;
  line-height:1.15;
  color:var(--text);
}
.machine-nom-modele{ font-weight:600; color:var(--primary-700); }

.machine-note .machine-text{ color:var(--muted); font-weight:700; }
.machine-etoile{ color:#f5c542; font-size:20px; margin-top:6px; display:inline-block; }

/* Prix badge (détail) */
.machine-prix p{
  display:inline-block;
  margin:10px 0 0;
  padding:10px 14px;
  background:linear-gradient(180deg,#ffe9e9,#ffe1e1);
  color:var(--danger);
  font-weight:900;
  border-radius:12px;
  box-shadow:0 6px 14px rgba(214,69,69,.14);
  line-height:1.25;
}

/* Bloc contact */
.machine-contact{
  margin-top:24px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:18px;
  font-weight:700;
  color:var(--text);
}
.machine-contact .custom-button,
.machine-pdf .custom-button{
  align-self:flex-start;
  width:auto;
  max-width:100%;
  white-space:nowrap;
}
.machine-contact .custom-button .machine-nom-modele{ display:none !important; }

/* =========================================
   Tableau de spécifications
   ========================================= */
.machine-specifications-table{
  background:#fff;
  border-radius:20px;
  padding:14px;
  border:1px solid var(--primary-120);
  box-shadow:var(--shadow-1);
  overflow:hidden;
}
.machine-specifications-table table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:transparent;
  font-size:15px;
  table-layout:fixed;
  word-wrap:break-word;
}

.machine-specifications-table th:first-child,
.machine-specifications-table td:first-child{ width:24%; }
.machine-specifications-table th:last-child,
.machine-specifications-table td:last-child{ width:76%; }

.machine-specifications-table th{
  background:linear-gradient(90deg,var(--primary-600),var(--primary));
  color:#fff;
  font-weight:900;
  letter-spacing:.02em;
  border:none;
  padding:16px 18px;
  position:sticky; top:0; z-index:1;
  text-shadow:0 1px 0 rgba(0,0,0,.08);
}
.machine-specifications-table tr:first-child th:first-child{ border-top-left-radius:14px; }
.machine-specifications-table tr:first-child th:last-child{  border-top-right-radius:14px; }

.machine-specifications-table td{
  padding:14px 18px;
  border:none;
  background:#fff;
  box-shadow:inset 0 -1px 0 var(--primary-120);
  vertical-align:top;
  color:var(--text);
}
.machine-specifications-table tbody tr:nth-child(even) td{ background:var(--surface-alt); }
.machine-specifications-table tbody tr{ transition:background-color .18s ease; }
.machine-specifications-table tbody tr:hover td{ background:var(--primary-050); }

.machine-specifications-table td:first-child{
  font-weight:800;
  color:var(--primary-700);
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden;
}

.machine-specifications-table tbody tr:last-child td:first-child{ border-bottom-left-radius:14px; }
.machine-specifications-table tbody tr:last-child td:last-child{  border-bottom-right-radius:14px; }

/* =========================================
   Section “Nos locations du moment”
   ========================================= */
.Home-location{
  margin-top:56px;
  margin-left:0;
  margin-bottom:72px;
}
.machines-container{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
  gap:22px;
  align-items:stretch;
}
.machine-card{
  margin:0;
  border-radius:20px;
  display:flex;
  flex-direction:column;
  padding:16px;
  background:#fff;
  border:1px solid var(--primary-120);
  box-shadow:var(--shadow-1);
  transition:transform .15s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.machine-card:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-2);
  border-color:var(--primary-200);
  background:linear-gradient(180deg,#ffffff,#f8fbf9);
}
.machine-card img{
  width:100%;
  height:200px;
  object-fit:cover;
  border:1px solid var(--primary-120);
  border-radius:14px;
}
.machine-card .CategorieMachine{
  font-style:italic;
  font-size:14px;
  color:var(--primary-600);
  margin-top:10px;
}
.machine-card .NomMachine{
  font-weight:900;
  font-size:20px;
  margin-top:8px;
  line-height:1.2;
  color:var(--text);
}
.machine-card .ModeleMachine{
  font-size:15px;
  font-weight:700;
  color:var(--primary-700);
}

/* === PRIX CARTES (FIX : retour à la ligne + badge compact) === */
.machine-card .PrixOccasion,
.machine-card .PrixLocation,
.machine-card .Prix{
  display:inline-block !important;    /* pas de flex -> le <br> fonctionne */
  width:auto !important;              /* largeur du texte uniquement */
  max-width:100%;
  white-space:normal !important;      /* autorise le retour à la ligne */
  line-height:1.25;
  margin-top:10px;
  padding:8px 12px;
  font-size:18px;
  font-weight:900;
  color:var(--danger);
  background:linear-gradient(180deg,#ffe9e9,#ffe1e1);
  border-radius:12px;
  box-shadow:0 6px 14px rgba(214,69,69,.12);
}
/* petit espace visuel entre les deux lignes */
.machine-card .PrixOccasion br,
.machine-card .PrixLocation br,
.machine-card .Prix br{
  content:"";
  display:block;
  margin-top:2px;
}

.machine-card .DescriptionEtatMachine{
  font-weight:500;
  margin-top:10px;
  color:var(--muted);
}
.machine-link{ text-decoration:none; color:inherit; }

/* =========================================
   Modal
   ========================================= */
.modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:50;
  background-color:rgba(26,112,68,.18);
  backdrop-filter:saturate(120%) blur(2px);
  padding-top:60px;
}
.modal-content{
  background:#fff;
  margin:5% auto;
  padding:22px;
  width:86%;
  max-width:560px;
  border:1px solid var(--primary-120);
  border-radius:16px;
  box-shadow:var(--shadow-2);
}
.close{
  color:var(--muted);
  float:right;
  font-size:28px;
  font-weight:900;
  line-height:1;
  cursor:pointer;
  transition:color .15s ease, transform .1s ease;
}
.close:hover,.close:focus{ color:var(--primary-700); transform:scale(1.06); }

/* =========================================
   Mobile (≤ 770px)
   ========================================= */
@media (max-width: 770px){

  /* Titres & trait */
  #location-info-title-text,
  .Home-location-title-text,
  .specification-title-text{
    font-size:18px;
    margin-top:30px;
    margin-left:5%;
    text-align:left;
    font-weight:800;
  }
  .title-underline{
    width:120px; height:10px; border-radius:999px;
    margin:6px 0 14px 5%;
    box-shadow:0 3px 8px rgba(16,84,47,.18);
    background:linear-gradient(90deg,var(--primary),#155a35,#6ccf6a);
  }

  /* Détails */
  .machine-details{
    display:block;
    text-align:center;
    padding:0 12px;
  }
  .machine-img-container{
    width:100%; height:auto; margin:0 auto;
    background:#ffffff;
    border:1px solid #e9ecef;
    border-radius:15px;
    padding:10px;
    box-shadow:0 8px 16px rgba(0,0,0,.1);
  }
  .machine-details img{ width:100%; height:auto; object-fit:contain; border-radius:12px; }
  .machine-info{ margin-left:0; margin-top:16px; }
  .machine-specifications{ font-size:12px; color:var(--primary); font-style:italic; }
  .machine-nom{ font-size:20px; margin-top:6px; font-weight:900; }
  .machine-nom-modele{ font-size:14px; font-weight:600; }
  .machine-note .machine-text{ font-weight:700; }
  .machine-etoile{ font-size:16px; }

  /* Prix détail (badge) */
  .machine-prix p{
    display:inline-block;
    margin:10px auto 0;
    padding:10px 14px;
    background:linear-gradient(180deg,#ffe9e9,#ffe1e1);
    color:#d64545;
    font-weight:900;
    border-radius:14px;
    box-shadow:0 6px 14px rgba(214,69,69,.12);
    line-height:1.25;
  }

  /* Boutons centrés */
  .machine-contact{
    margin-top:20px;
    font-weight:bold;
    display:flex;
    flex-direction:column;
    gap:14px;
    align-items:center;
  }
  .custom-button{
    display:inline-flex; align-items:center; justify-content:center;
    width:auto !important; max-width:92%;
    padding:10px 16px;
    font-size:.95rem;
    border-radius:12px;
    text-align:center;
    white-space:normal;
    margin:0 auto !important;
  }
  .machine-pdf .custom-button{ width:auto !important; max-width:92%; margin:0 auto !important; }
  .machine-contact .custom-button .machine-nom-modele{ display:none !important; }
  .machine-contact .custom-button, .machine-contact .custom-button *{ color:#ffffff !important; }

  /* Section cartes */
  .Home-location{ margin:60px 0; }
  .machines-container{ display:block; padding:0 12px; }
  .machine-card{
    width:100%;
    height:auto;
    padding:15px;
    margin:10px auto;
    background:#ffffff;
    border:1px solid #e6e6e6;
    border-radius:15px;
    box-shadow:0 4px 8px rgba(0,0,0,0.1);
  }
  .machine-card img{ width:100%; height:auto; border-radius:15px; border:1px solid #e6e6e6; }
  .machine-card .CategorieMachine{ font-size:12px; color:var(--primary); }
  .machine-card .NomMachine{ font-size:18px; font-weight:900; }
  .machine-card .ModeleMachine{ font-size:14px; font-weight:600; }

  /* PRIX CARTES (FIX conservé en mobile) */
  .machine-card .PrixOccasion,
  .machine-card .PrixLocation,
  .machine-card .Prix{
    display:inline-block !important;
    width:auto !important;
    max-width:100%;
    white-space:normal !important;
    line-height:1.25;
    margin-top:10px;
    padding:8px 12px;
    background:linear-gradient(180deg,#ffe9e9,#ffe1e1);
    color:#d64545;
    font-weight:900;
    border-radius:12px;
    box-shadow:0 6px 14px rgba(214,69,69,.12);
  }
  .machine-card .DescriptionEtatMachine{ font-size:12px; }

  /* Tableau */
  .machine-specifications-table{
    padding:8px;
    border-radius:14px;
    border:1px solid #e9ecef;
    box-shadow:0 10px 24px rgba(0,0,0,.06);
    background:#fff;
    margin:0 12px;
  }
  .machine-specifications-table table{ width:100%; border-collapse:separate; border-spacing:0; font-size:14px; }
  .machine-specifications-table th,
  .machine-specifications-table td{ padding:12px 14px; }
  .machine-specifications-table th{
    background:linear-gradient(90deg,var(--primary),#155a35);
    color:#fff; font-weight:700; text-align:left;
  }
  .machine-specifications-table td{ background:#ffffff; box-shadow:inset 0 -1px 0 #eef1f0; }
  .machine-specifications-table tbody tr:nth-child(even) td{ background:#fafdfb; }
}