html, body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Container général */
.container {
    width: 90%;
    max-width: 1100px;
    margin: 30px auto;
    font-family: 'Segoe UI', sans-serif;
    overflow-x: auto;
    position: relative;
    -webkit-overflow-scrolling: touch; /* scroll fluide iOS */
}

/* Scroll horizontal esthétique */
.container::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 20px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
}

.container::-webkit-scrollbar { height: 8px; }
.container::-webkit-scrollbar-thumb { background-color: #ff6600; border-radius: 4px; }
.container::-webkit-scrollbar-track { background-color: #f1f1f1; }

/* Bouton retour */
.back-home {
    text-align: center;
    margin-bottom: 20px;
}
.back-home a {
    background-color: #333;
    color: #fff;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
}
.back-home a:hover,
.back-home a:focus {
    background-color: #ff6600;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,102,0,0.4);
}

/* Titre */
.title {
    text-align: center;
    font-size: 2.2em;
    color: #333;
    margin-bottom: 30px;
}

/* Tableau général */
.tarif-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
    transition: all 0.3s ease;
}

/* Header du tableau */
.tarif-table th {
    background: linear-gradient(90deg, #333, #444);
    color: #fff;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: inset 0 -2px 0 rgba(255,255,255,0.1);
    transition: background 0.3s ease;
}
.tarif-table th:hover {
    background: linear-gradient(90deg, #444, #555);
}

/* Ligne séparateur entre pôles */
.tarif-table tr.pole-separator td {
    border-top: 4px solid #ff6600;
    padding: 0;
    height: 8px;
    background-color: transparent;
}

/* Cellule Pôle */
.tarif-table td.pole {
    background-color: #ffe8cc;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
    padding: 14px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.tarif-table td.pole:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(255,102,0,0.3);
    background: linear-gradient(135deg, #ffe0b3, #ffd1a3);
}

/* Alternance subtile pour services (hors pôle) */
.tarif-table tr.service-row:nth-child(even) td:not(.pole) { background-color: #fcfcfc; }
.tarif-table tr.service-row:nth-child(odd)  td:not(.pole) { background-color: #f7f7f7; }

/* Hover dynamique sur toutes les cellules */
.tarif-table tr.service-row td { transition: all 0.3s ease; }
.tarif-table tr.service-row td:hover {
    background: linear-gradient(120deg, #fff8f0, #fff3e6);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-radius: 4px;
}

/* Ombre subtile entre les lignes */
.tarif-table tr.service-row { box-shadow: inset 0 -1px 0 #e0e0e0; }

/* Sticky première colonne pour noms de services */
.tarif-table td:first-child {
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 5;
    font-weight: 500;
    border-right: 1px solid #e0e0e0;
}

/* Tarif badges améliorés */
.tarif-table td.tarif {
    font-weight: bold;
    text-align: right;
    width: 140px;
    padding-left: 16px;
    border-left: 2px solid #ff6600;
}
.tarif-table td.tarif span {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    background-size: 200% 200%;
}

/* Badge gradients adaptés */
.tarif-table td.tarif span.horaire    { background: linear-gradient(135deg, #ff9f43, #ff6f00); }
.tarif-table td.tarif span.forfait    { background: linear-gradient(135deg, #5dade2, #2874a6); }
.tarif-table td.tarif span.volume     { background: linear-gradient(135deg, #58d68d, #28a745); }
.tarif-table td.tarif span.superficie { background: linear-gradient(135deg, #af7ac5, #c0392b); }
.tarif-table td.tarif span.surdevis   { background: linear-gradient(135deg, #ff77aa, #ff3388); }

/* Badge hover micro-bounce */
.tarif-table td.tarif span:hover {
    animation: bounce 0.4s;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

/* Remarque */
.tarif-table td.remarque {
    font-size: 0.95em;
    color: #444;
    font-style: italic;
    text-align: center;
    vertical-align: middle;
    padding: 6px 10px;
}
.tarif-table td.remarque i {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 50%;
    background-color: #ff6600;
    color: #fff;
    font-style: normal;
    font-weight: bold;
    text-align: center;
    margin-right: 5px;
    transition: transform 0.3s ease;
}
.tarif-table td.remarque i:hover { transform: scale(1.2); }

/* Animations clés */
@keyframes bounce {
    0%   { transform: scale(1); }
    25%  { transform: scale(1.2); }
    50%  { transform: scale(0.95); }
    75%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===========================================================
   ✅ MOBILE — AFFICHAGE LISIBLE (PAS XXL)
   - On garde le scroll horizontal + sticky
   - Ta page reste “confortable” mais normale
   =========================================================== */
@media screen and (max-width: 768px) {

  .container{
    width: 94% !important;
    margin: 16px auto !important;
  }

  .back-home a{
    font-size: 16px !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    min-height: 44px !important;
  }

  .title{
    font-size: 28px !important;
    line-height: 1.2 !important;
    margin-bottom: 16px !important;
  }

  /* Table: scroll horizontal conservé */
  .tarif-table{
    min-width: 860px !important; /* suffisamment large, mais moins violent que 980 */
  }

  .tarif-table th,
  .tarif-table td{
    padding: 12px 12px !important;
    font-size: 15px !important;
    line-height: 1.45 !important;
  }

  .tarif-table td:first-child{
    min-width: 260px !important;
    font-weight: 700 !important;
  }

  .tarif-table td.pole{
    font-size: 16px !important;
    padding: 14px 12px !important;
  }

  .tarif-table td.tarif{
    width: 170px !important;
  }

  .tarif-table td.tarif span{
    font-size: 13px !important;
    padding: 7px 10px !important;
    border-radius: 14px !important;
  }

  .tarif-table td.remarque{
    font-size: 14px !important;
    padding: 10px 12px !important;
  }

  .tarif-table td.remarque i{
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    font-size: 14px !important;
    margin-right: 6px !important;
  }
}

/* Très petits téléphones : petit boost léger (pas XXL) */
@media screen and (max-width: 420px){
  .title{ font-size: 30px !important; }
  .tarif-table th, .tarif-table td{ font-size: 15px !important; }
  .tarif-table td.pole{ font-size: 16px !important; }
  .tarif-table td.tarif span{ font-size: 13px !important; }
}

/* Tactile: pas d'hover qui “saute” */
@media (hover: none) and (pointer: coarse){
  .tarif-table tr.service-row td:hover,
  .tarif-table td.pole:hover,
  .tarif-table td.tarif span:hover{
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
  }
}

/* ===========================================================
   ✅ FIX MOBILE : la 1ère colonne sticky recouvre tout
   -> on désactive sticky sur mobile pour éviter le "gros bloc"
   =========================================================== */
@media screen and (max-width: 768px) {

  /* On garde le scroll horizontal */
  .container{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ✅ Désactive le sticky de la 1ère colonne sur mobile */
  .tarif-table td:first-child,
  .tarif-table th:first-child{
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    border-right: none !important;
  }

  /* ✅ Enlève les effets qui accentuent la superposition */
  .tarif-table tr.service-row td:hover{
    transform: none !important;
    box-shadow: none !important;
  }

  /* Optionnel : un peu plus stable visuellement sur mobile */
  .tarif-table{
    table-layout: auto;
  }

  /* Pôle : évite le gros bloc trop haut */
  .tarif-table td.pole{
    white-space: normal !important;
    word-break: break-word;
    text-align: center;
  }

  /* Badges tarif : évite qu'ils "sortent" ou poussent trop */
  .tarif-table td.tarif{
    white-space: nowrap;
  }
  .tarif-table td.tarif span{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
  }
  .tarif-table th,
  .tarif-table td{
    font-size: 14px !important;
    padding: 10px 10px !important;
    line-height: 1.35 !important;
  }
  .tarif-table td:first-child{
    min-width: 220px !important; /* au lieu de 260/320 */
  }
  .tarif-table{
    min-width: 780px !important;
  }
}

/* ===========================================================
   ✅ MOBILE FIX : éviter que la 1ère colonne (Pôle) recouvre tout
   + forcer les retours à la ligne pour réduire la largeur
   =========================================================== */
@media screen and (max-width: 768px) {

  /* Container scroll horizontal fluide */
  .container{
    width: 94% !important;
    margin: 16px auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ✅ Désactive le sticky sur mobile (c'est ça qui "fout la merde") */
  .tarif-table th:first-child,
  .tarif-table td:first-child{
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    border-right: none !important;
  }

  /* Table : on réduit un peu la largeur mini pour éviter un scroll énorme */
  .tarif-table{
    min-width: 760px !important; /* au lieu de 980px */
  }

  /* Typo + padding : plus raisonnable */
  .tarif-table th,
  .tarif-table td{
    padding: 12px 12px !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  /* ✅ COLONNE PÔLE : on force le retour à la ligne + largeur max */
  .tarif-table td.pole{
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    max-width: 160px !important;     /* réduit la colonne */
    min-width: 140px !important;
    font-size: 16px !important;
    padding: 14px 10px !important;
    text-align: center;
  }

  /* Sous-service : garde une bonne largeur */
  .tarif-table td[data-label="Sous-service"]{
    min-width: 260px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Remarque : évite les colonnes énormes */
  .tarif-table td.remarque{
    min-width: 220px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Tarif : reste compact */
  .tarif-table td.tarif{
    width: 140px !important;
    white-space: nowrap !important;
  }
  .tarif-table td.tarif span{
    font-size: 13px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
  }

  /* ✅ Désactive les hover "sauts" sur mobile */
  .tarif-table tr.service-row td:hover,
  .tarif-table td.pole:hover,
  .tarif-table td.tarif span:hover{
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
  }
}

/* Très petits téléphones */
@media screen and (max-width: 420px){
  .tarif-table{
    min-width: 720px !important;
  }
  .tarif-table td.pole{
    max-width: 140px !important;
    min-width: 120px !important;
    font-size: 15px !important;
  }
}

/* ===========================================================
   ✅ MOBILE FIX – réduire la 2ème colonne (Sous-service)
   =========================================================== */
@media screen and (max-width: 768px) {

  /* Sous-service : on limite la largeur + wrap propre */
  .tarif-table td[data-label="Sous-service"],
  .tarif-table th:nth-child(2){
    max-width: 240px !important;   /* 🔽 réduit fortement */
    min-width: 220px !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  /* Évite que le texte pousse la colonne */
  .tarif-table td[data-label="Sous-service"]{
    hyphens: auto;
  }

  /* Ajustement global pour que tout tienne mieux */
  .tarif-table{
    min-width: 700px !important;   /* encore plus compact */
  }
}

/* Très petits téléphones */
@media screen and (max-width: 420px){

  .tarif-table td[data-label="Sous-service"],
  .tarif-table th:nth-child(2){
    max-width: 200px !important;
    min-width: 180px !important;
    font-size: 14px !important;
  }

  .tarif-table{
    min-width: 660px !important;
  }
}

/* ===========================================================
   ✅ MOBILE — MODE "CARDS" (lisible, sans scroll horizontal)
   - Désactive sticky colonnes
   - Cache le header du tableau
   - Chaque ligne devient une "carte" empilée
   =========================================================== */
@media (max-width: 768px){

  /* Container sans scroll horizontal */
  .container{
    overflow-x: visible !important;
  }
  .container::after{ display:none !important; }

  /* Table devient "block" */
  .tarif-table{
    min-width: 0 !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
  }

  /* On masque l'en-tête (inutile en cards) */
  .tarif-table thead{
    display: none !important;
  }

  /* Chaque ligne = carte */
  .tarif-table tbody tr.service-row{
    display: block !important;
    background: #fff !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08) !important;
    overflow: hidden !important;
  }

  /* Désactive tous les sticky qui cassent tout */
  .tarif-table td:first-child{
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    border-right: none !important;
    background: transparent !important;
  }

  /* Les cellules deviennent des lignes "label : valeur" */
  .tarif-table tbody tr.service-row td{
    display: flex !important;
    gap: 10px !important;
    align-items: flex-start !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    border: none !important;
  }

  /* Label à gauche (data-label) */
  .tarif-table tbody tr.service-row td::before{
    content: attr(data-label);
    flex: 0 0 110px;
    max-width: 110px;
    font-weight: 800;
    color: rgba(15,23,42,.75);
  }

  /* Valeur à droite */
  .tarif-table tbody tr.service-row td{
    justify-content: space-between;
  }
  .tarif-table tbody tr.service-row td > *{
    max-width: calc(100% - 120px);
  }

  /* --- PÔLE --- */
  /* Si cellule pôle vide (lignes suivantes), on la cache */
  .tarif-table td.pole:empty{
    display: none !important;
  }

  /* Si nouveau pôle : on l’affiche en "header" de carte */
  .tarif-table tr.new-pole td.pole{
    display: block !important;
    padding: 14px 14px !important;
    background: linear-gradient(135deg, #ffe8cc, #ffd7ad) !important;
    font-weight: 900 !important;
    text-align: left !important;
    font-size: 16px !important;
  }
  .tarif-table tr.new-pole td.pole::before{
    content: "Pôle";
    display: inline-block;
    margin-right: 10px;
    font-weight: 900;
    color: rgba(15,23,42,.7);
  }

  /* --- REMARQUES --- */
  .tarif-table td.remarque i{
    flex: 0 0 auto;
    margin-right: 8px;
  }

  /* --- TARIF --- */
  .tarif-table td.tarif{
    text-align: left !important;
    width: auto !important;
    border-left: none !important;
  }
  .tarif-table td.tarif span{
    font-size: 14px !important;
    padding: 8px 12px !important;
    border-radius: 14px !important;
  }

  /* Séparateur entre pôles : inutile en cards */
  .tarif-table tr.pole-separator{
    display: none !important;
  }

  /* Hover "saut" désactivé sur mobile */
  .tarif-table tr.service-row td:hover,
  .tarif-table td.pole:hover,
  .tarif-table td.tarif span:hover{
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
  }
}

/* Très petits téléphones */
@media (max-width: 420px){
  .tarif-table tbody tr.service-row td::before{
    flex: 0 0 92px;
    max-width: 92px;
  }
  .tarif-table tbody tr.service-row td{
    font-size: 14px !important;
  }
}