/* ============================================================================
   LE MONDE ENSEMBLE — V614 SYSTÈME ÉDITORIAL & RESPONSIVE UNIFIÉ
   Ordinateur (>1024px) · Tablette (641px–1024px) · Téléphone (<=640px & <=390px)
   Qualité magazine voyage haut de gamme, lisibilité optimale & zéro débordement
   ============================================================================ */

:root {
  --lme-ink: #102330;
  --lme-muted: #526574;
  --lme-teal: #0b5e65;
  --lme-teal-dark: #08454a;
  --lme-gold: #d6a34f;
  --lme-cream: #f7f3eb;
  --lme-card-radius: 18px;
  --lme-shadow-soft: 0 12px 30px rgba(11, 42, 59, 0.07);
}

/* 1. Anti-débordement horizontal universel & typographie fluide */
html, body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, picture, video, canvas, svg, iframe {
  max-width: 100%;
  height: auto;
}

/* 2. Harmonisation éditoriale des cartes, boutons et formulaires */
.card, .panel, .deal-card, .kpi, .guide-card {
  border-radius: var(--lme-card-radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.deal-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid rgba(16, 35, 48, 0.1);
  box-shadow: var(--lme-shadow-soft);
}

.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(11, 42, 59, 0.12);
}

.deal-card .body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.btn, button, input[type="submit"] {
  touch-action: manipulation;
}

/* Formulaire d'inscription infolettre sur promotions-voyages.html (alignement propre avec bouton et lien veille) */
#newsletterForm {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: center !important;
  max-width: 820px !important;
}
#newsletterForm input[type="email"] {
  flex: 1 1 260px !important;
  min-width: 220px !important;
}
#newsletterForm .deals-alert-consent {
  flex: 1 1 100% !important;
  width: 100% !important;
}

/* 3. TABLETTE (641px à 1024px) : grilles équilibrées en 2 colonnes au lieu de 3 colonnes écrasées */
@media screen and (min-width: 641px) and (max-width: 1024px) {
  .wrap, .container, main.wrap {
    width: min(94vw, 980px) !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .grid,
  .deals-grid,
  .guide-links,
  .destinations-grid,
  .cards-grid,
  #dealsGrid,
  #aiAgentResultsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }

  .hero-grid,
  .layout,
  .split-layout {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #newsletterForm {
    grid-template-columns: 1fr 1fr !important;
  }

  #newsletterForm button[type="submit"] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
}

/* 4. TÉLÉPHONE (<= 640px) : 1 colonne fluide, cibles tactiles >= 44px, zéro débordement */
@media screen and (max-width: 640px) {
  .wrap, .container, main.wrap {
    width: 100% !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  h1, .hero h1 {
    font-size: clamp(1.55rem, 6.2vw, 2.05rem) !important;
    line-height: 1.18 !important;
  }

  h2 {
    font-size: clamp(1.25rem, 5vw, 1.55rem) !important;
    line-height: 1.24 !important;
  }

  .hero, .panel, .card {
    padding: 16px 14px !important;
    border-radius: 16px !important;
  }

  /* Forcer toutes les grilles multi-colonnes en 1 seule colonne propre sur mobile */
  .grid,
  .deals-grid,
  .guide-links,
  .destinations-grid,
  .cards-grid,
  .form-grid,
  .toolbar,
  .kpis,
  .hero-grid,
  .layout,
  #dealsGrid,
  #aiAgentResultsGrid,
  #newsletterForm,
  #visitorWatchForm {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Corriger les éléments avec style inline grid-column: span 2 qui forçaient 2 colonnes sur mobile */
  .form-grid > *,
  .grid > *,
  #visitorWatchForm > *,
  #newsletterForm > *,
  [style*="grid-column:span 2"],
  [style*="grid-column: span 2"] {
    grid-column: 1 / -1 !important;
  }

  /* Taille de police 16px sur les champs de saisie mobiles pour éviter le zoom automatique iOS */
  input, select, textarea {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  /* Barres de navigation et en-têtes adaptatifs */
  .topbar .nav,
  header .nav,
  .nav {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }

  .nav-links {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .nav-links a,
  .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Tableaux larges rendus défilables horizontalement sans casser la page */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Fenêtre modale Fiche Bon Plan responsive sur téléphone */
  #lmeDealDetailModal {
    padding: 10px !important;
  }
  #lmeDealDetailModal > div {
    border-radius: 16px !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
  }
}

/* 5. TRÈS PETITS ÉCRANS (<= 390px : iPhone SE / Mini / Galaxy S) */
@media screen and (max-width: 390px) {
  .wrap, .container, main.wrap {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .deal-actions {
    flex-direction: column !important;
  }

  .deal-actions .btn,
  .deal-actions a {
    width: 100% !important;
    text-align: center !important;
  }
}
