/* ════════════════════════════════════════════
   assets/css/mobile.css
   Correctifs responsive mobile-first
   À inclure APRÈS main.css dans header.php
════════════════════════════════════════════ */

/* ── BREAKPOINTS
   xs  < 480px  (petits téléphones)
   sm  < 640px  (téléphones standards)
   md  < 768px  (grands téléphones / petites tablettes)
   lg  < 1024px (tablettes)
   ── */

/* ── BASE MOBILE ─────────────────────────── */
html { -webkit-text-size-adjust: 100%; }

body {
  /* Évite le dépassement horizontal sur mobile */
  overflow-x: hidden;
}

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

/* ── NAV MOBILE ──────────────────────────── */
@media (max-width: 768px) {
  .nav-inner {
    padding: 0 1rem;
    height: 56px;
    gap: .6rem;
  }

  .logo-name { font-size: 14px; }
  .logo-mark { width: 30px; height: 30px; font-size: 11px; }

  .nav-links  { display: none !important; }
  .btn-o      { display: none; }

  /* Bouton surprends-moi : icône seule sur xs */
  .btn-p.nav-surprise-txt { display: none; }

  .nav-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 18px;
  }

  /* Menu mobile déroulant */
  .nav-mobile {
    padding: .5rem 1rem .75rem;
  }

  .nav-mobile a {
    padding: .75rem 0;
    font-size: 15px;
    font-weight: 400;
  }
}

/* ── HERO ────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.25rem 1.75rem;
  }

  .hero h1 {
    font-size: 2.2rem;
    letter-spacing: -.02em;
    line-height: 1.05;
  }

  .hero-sub {
    font-size: 14px;
    margin-bottom: 1.5rem;
  }

  .hero-pill { font-size: 10px; }

  /* Barre de recherche : colonne sur mobile */
  .hero-search {
    flex-direction: column;
    border-radius: 10px;
    max-width: 100%;
  }

  .hero-search input {
    padding: 13px 14px;
    font-size: 15px; /* évite le zoom iOS */
    border-bottom: 1px solid var(--bord);
    border-radius: 0;
  }

  .hero-search select {
    border-left: none;
    border-bottom: 1px solid var(--bord);
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 0;
  }

  .hero-search .btn-p {
    border-radius: 0 0 10px 10px;
    padding: 13px;
    text-align: center;
    font-size: 14px;
  }

  /* Stats : scroll horizontal compact */
  .hero-stats {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 10px;
  }

  .hero-stats::-webkit-scrollbar { display: none; }

  .hstat {
    padding: 10px 16px;
    flex-shrink: 0;
  }

  .hstat-n { font-size: 1.4rem; }
  .hstat-l { font-size: 10px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.85rem; }
  .hero { padding: 1.5rem 1rem 1.5rem; }
}

/* ── FILTER BAR ──────────────────────────── */
@media (max-width: 768px) {
  .fbar { padding: 0 1rem; }

  .fbar-inner {
    gap: 5px;
    height: 46px;
    /* Masquer le select tri sur mobile */
  }

  .fp { padding: 4px 11px; font-size: 11px; }

  .fp-sort { display: none; } /* Trop serré sur mobile, on le retire */
}

/* ── PAGE HEADER ─────────────────────────── */
@media (max-width: 768px) {
  .page-hdr { padding: 1.25rem 1rem 1rem; }
  .page-ttl { font-size: 1.5rem; }
  .breadc   { font-size: 11px; }
}

/* ── MAIN CONTENT PADDING ────────────────── */
@media (max-width: 768px) {
  .main { padding: 1.25rem 1rem; }
  .wrap { padding: 0 1rem; }
}

/* ── SECTION HEADERS ─────────────────────── */
@media (max-width: 640px) {
  .sec-hdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 1rem;
  }

  .sec-ttl { font-size: 1.2rem; }
  .sec-lnk { font-size: 12px; }
}

/* ── GRILLES ─────────────────────────────── */
@media (max-width: 900px) {
  .grid3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid4 { grid-template-columns: 1fr 1fr; gap: 10px; }
}

@media (max-width: 580px) {
  .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .grid4 { grid-template-columns: 1fr; }
}

/* ── CARTE FEATURED (span 2 colonnes) ───── */
@media (max-width: 900px) {
  .card-feat {
    grid-column: span 1;
    grid-template-columns: 1fr;
    display: block;
  }

  .card-feat .cimg { height: 180px; }
  .card-feat-body  { padding: 1rem; }
}

/* ── CARDS ───────────────────────────────── */
@media (max-width: 480px) {
  .cimg        { height: 140px; }
  .cbody       { padding: 11px 12px; }
  .ctitle      { font-size: 14px; }
  .cdesc       { font-size: 12px; }
  .card-feat .cimg { height: 160px; }
}

/* ── ÉVÉNEMENTS ──────────────────────────── */
@media (max-width: 640px) {
  .ev {
    gap: 10px;
    padding: 11px 12px;
    flex-wrap: nowrap;
  }

  .evdate { width: 38px; }
  .evd    { font-size: 18px; }
  .evm    { font-size: 8px; }

  .evtitle {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .evmeta { font-size: 11px; }

  /* Tags : masquer "Auto" sur mobile, garder cat */
  .ev .ch-dim { display: none; }

  .evtags { gap: 4px; }
  .chip   { font-size: 9px; padding: 2px 7px; }
}

@media (max-width: 480px) {
  /* Sur très petit écran : séparateur vertical masqué */
  .evsep { display: none; }
  .ev    { gap: 8px; }
}

/* ── ACTIVITÉS ───────────────────────────── */
@media (max-width: 580px) {
  .act-img   { height: 110px; font-size: 2.2rem; }
  .act-title { font-size: 13px; }
  .act-desc  { font-size: 11px; }
  .act-body  { padding: 10px 12px; }
}

/* ── BANNER IMPORT ADMIN ─────────────────── */
@media (max-width: 640px) {
  .imp-banner {
    flex-wrap: wrap;
    gap: 8px;
    padding: .75rem 1rem;
  }

  .imp-txt strong { font-size: 12px; }
  .imp-txt p      { font-size: 10px; }
}

/* ── CARTE MAP ───────────────────────────── */
@media (max-width: 768px) {
  .map-body { height: 200px; }

  .map-hdr {
    flex-direction: column;
    align-items: flex-start;
    padding: .75rem 1rem;
    gap: 6px;
  }

  .map-hdr > div { overflow-x: auto; display: flex; gap: 5px; }
}

/* ── TABS ────────────────────────────────── */
@media (max-width: 640px) {
  .tabs-bar { padding: 0 1rem; }
  .tab      { padding: 9px 12px; font-size: 12px; }
}

/* ── COLLABORATION ───────────────────────── */
@media (max-width: 768px) {
  .coll-hero { padding: 2.5rem 1.25rem; }
  .coll-hero h2 { font-size: 1.75rem; }
  .coll-hero p  { font-size: 14px; }
  .coll-btns { flex-direction: column; align-items: center; }
  .btn-wh, .btn-wh-o { width: 100%; max-width: 280px; text-align: center; }

  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 1rem .75rem; }
  .kpi-n { font-size: 1.6rem; }
  .kpi-l { font-size: 11px; }

  .offers {
    grid-template-columns: 1fr;
    padding: 1.25rem 1rem;
    gap: 12px;
  }

  .offer { padding: 1.25rem; }
  .offer-price { font-size: 1.7rem; }
}

@media (max-width: 480px) {
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi { border-right: none; border-bottom: 1px solid var(--bord); }
  .kpi:nth-child(odd) { border-right: 1px solid var(--bord); }
}

/* ── FORMULAIRE ──────────────────────────── */
@media (max-width: 640px) {
  .form-wrap  { padding: 1.5rem 1rem; }
  .fgrid      { grid-template-columns: 1fr; }
  .fg.full    { grid-column: span 1; }
  .form-foot  { flex-direction: column; align-items: flex-start; gap: 10px; }
  .btn-submit { width: 100%; text-align: center; }

  .fi { font-size: 16px; } /* évite zoom iOS sur focus */
}

/* ── FICHE DÉTAIL ────────────────────────── */
@media (max-width: 768px) {
  .detail-name { font-size: 1.8rem; }
  .detail-meta { gap: 8px; font-size: 12px; flex-wrap: wrap; }
  .detail-sync { font-size: 10px; padding: 4px 9px; }

  .detail-body {
    grid-template-columns: 1fr;
    padding: 1.25rem 1rem;
    gap: 1.25rem;
  }
}

@media (max-width: 480px) {
  .detail-name { font-size: 1.5rem; }
  .detail-hero { padding: 1.5rem 1rem 1.25rem; }
}

/* ── FOOTER ──────────────────────────────── */
@media (max-width: 900px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

@media (max-width: 580px) {
  .foot-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  footer { padding: 1.75rem 1rem 1.5rem; }

  .foot-bottom {
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    text-align: center;
  }

  .foot-desc { max-width: 100%; }
}

/* ── PAGE LÉGALE ─────────────────────────── */
@media (max-width: 768px) {
  .legal-content {
    padding: 1.5rem 1rem;
    font-size: 14px;
  }

  .legal-content h2 { font-size: 1.1rem; }
}

/* ── BANDEAU COOKIES ─────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surf);
  border-top: 1px solid var(--bord);
  padding: 1rem 1.5rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.34,1.1,.64,1);
}

#cookie-banner.visible {
  transform: translateY(0);
}

.cookie-text {
  flex: 1;
  font-size: 13px;
  color: var(--tx2);
  min-width: 200px;
  line-height: 1.5;
}

.cookie-text a {
  color: var(--blue);
  text-decoration: underline;
}

.cookie-text strong {
  color: var(--tx);
  font-weight: 600;
}

.cookie-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

@media (max-width: 580px) {
  #cookie-banner {
    padding: .875rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }

  .cookie-actions {
    width: 100%;
  }

  .cookie-actions .btn-p,
  .cookie-actions .btn-o {
    flex: 1;
    text-align: center;
  }
}

/* ── PAGINATION ──────────────────────────── */
@media (max-width: 480px) {
  .pagination { gap: 4px; }
  .pag-btn    { padding: 5px 9px; font-size: 12px; }
}

/* ── FLASH MESSAGE ───────────────────────── */
@media (max-width: 640px) {
  .flash {
    left: 1rem;
    right: 1rem;
    transform: none;
    text-align: center;
    font-size: 13px;
    white-space: normal;
  }
}

/* ── ADMIN RESPONSIVE ────────────────────── */
@media (max-width: 900px) {
  .adm-wrap {
    grid-template-columns: 1fr;
  }

  .adm-side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--bord);
    padding: 0;
  }

  .adm-sec      { display: none; }
  .adm-top      { flex-shrink: 0; padding: .75rem 1rem; border-bottom: none; border-right: 1px solid var(--bord); }
  .adm-lnk      { padding: .75rem 1rem; white-space: nowrap; border-right: none; border-bottom: 2px solid transparent; height: 48px; }
  .adm-lnk.on   { border-bottom-color: var(--blue); border-right: none; }
  .adm-bge      { display: none; }

  .adm-con { padding: 1rem; }
  .mets    { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 580px) {
  .mets { grid-template-columns: 1fr 1fr; gap: 8px; }
  .met-v { font-size: 1.5rem; }

  .tbl-hdr { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tbl-acts { flex-wrap: wrap; width: 100%; }
  .tbl-search { width: 100%; }

  /* Table scroll horizontal sur mobile */
  .tbl-wrap { overflow-x: auto; }
  table { min-width: 600px; }
}

/* ── TOUCH : agrandir les zones cliquables ── */
@media (max-width: 768px) {
  .abt {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .btn-xs { padding: 7px 13px; }
}

/* ── SAFE AREA iOS (notch, home indicator) ── */
@supports (padding: env(safe-area-inset-bottom)) {
  #cookie-banner {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .nav-mobile.open {
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
  }
}

/* ── SCROLL SMOOTH TOUCH ─────────────────── */
.fbar-inner,
.hero-stats,
.adm-side {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

/* ── FOCUS VISIBLE (accessibilité) ──────── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── UTILITAIRES ─────────────────────────── */
.hide-mobile  { display: none !important; }
@media (min-width: 769px) {
  .hide-mobile  { display: initial !important; }
  .show-mobile  { display: none   !important; }
}

/* ── CORRECTIF IMAGES MOBILE ─────────────────────── */
/* Assure que les images ne sont jamais tronquées */
.cimg, .act-img {
  position: relative;
  overflow: hidden;
}

.cimg img,
.act-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Placeholder emoji centré si pas d'image */
.cimg > span:not(.cbg):not(.csrc):not(.cimg-ov),
.act-img > span:not(.cbg) {
  position: relative;
  z-index: 1;
}

/* Carte featured : hauteur min sur mobile */
@media(max-width:900px) {
  .card-feat .cimg { min-height:180px; }
}

@media(max-width:580px) {
  .cimg { max-height:160px; }
  .act-img { max-height:140px; }
}
