/* ================================================
   layout.css — Header, nav, hero, footer, grilles
   ================================================ */

/* ─── HEADER ────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(2,8,16,.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: none; /* bande tricolore assurée par .hairline dans le DOM */
  transition: transform .3s ease;
  will-change: transform;
}
/* Auto-hide en mobile : classe posée par initAutoHideHeader() (script.js),
   uniquement ≤768px → cache au scroll bas, réapparaît au scroll haut */
header.nav-hidden { transform: translateY(-100%); }
/* Perf mobile : pas de backdrop-blur (re-floute chaque frame de scroll). Le fond rgba(.85) suffit. */
@media (max-width: 900px) {
  header { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6rem;
  height: 72px;
  max-width: 1344px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

/* ─── LOGO ───────────────────────────────────────── */
.logo {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 2.65rem;
  color: #fff;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
}
.logo b {
  color: var(--cyan);
  font-weight: 700;
}

/* ─── NAV ────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

/* ─── NAV ACTIONS (droite) ───────────────────────── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: flex-end;
}
.nav-btn-auth {
  padding: .4rem .9rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}
.nav-btn-auth:hover {
  color: var(--text);
  border-color: rgba(var(--cyan-rgb),.4);
}
.nav-btn-deposer {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .5rem 1.25rem;
  font-size: .98rem;
  font-weight: 700;
  color: #020204;
  background: var(--orange);
  border: none;
  border-radius: var(--r-s);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity var(--t);
}
.nav-btn-deposer:hover { opacity: .88; }

nav a {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem .2rem;
  border-radius: var(--r-s);
  font-size: .92rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color var(--t), background var(--t);
  white-space: nowrap;
}
nav a:hover {
  color: var(--text);
  background: rgba(var(--cyan-rgb),.07);
}
nav a.active {
  color: var(--cyan);
  background: rgba(var(--cyan-rgb),.10);
}

.nav-cta {
  padding: .45rem 1rem !important;
  border: 1px solid var(--cyan) !important;
  color: var(--cyan) !important;
  background: rgba(var(--cyan-rgb),.07) !important;
  border-radius: var(--r-s) !important;
  font-weight: 600 !important;
  transition: background var(--t), box-shadow var(--t) !important;
}
.nav-cta:hover {
  background: rgba(var(--cyan-rgb),.15) !important;
  box-shadow: var(--cyan-glow-sm) !important;
}

/* Badge notif nav */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--orange);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 9px;
  line-height: 1;
}

/* ─── HAMBURGER (mobile) ────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
}
.hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* Mobile nav drawer */
.nav-mobile {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: rgba(5,12,28,.97);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem 1.5rem;
  gap: .25rem;
  z-index: calc(var(--z-header) - 1);
  animation: slideDown var(--t);
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: .75rem 1rem;
  border-radius: var(--r-s);
  font-size: .95rem;
  color: var(--text);
}
.nav-mobile a:hover { background: rgba(var(--cyan-rgb),.08); color: var(--cyan); }

/* ─── HERO ───────────────────────────────────────── */
.hero {
  position: relative;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  overflow: hidden;
  z-index: 1;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 50% 0%, rgba(0,100,255,.12) 0%, transparent 65%),
    radial-gradient(ellipse 400px 300px at 80% 70%, rgba(var(--cyan-rgb),.07) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 .accent  { color: var(--cyan); }
.hero h1 .accent2 { color: var(--orange); }

.hero p {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 520px;
  margin: 0 auto 2rem;
}

/* Hero script decoratif */
.hero-script {
  font-family: var(--font-script);
  font-size: 4rem;
  color: rgba(255,255,255,.12);
  display: block;
  margin-bottom: .5rem;
  line-height: 1;
}

/* ─── TITRES DE SECTION ─────────────────────────── */
.section-header {
  margin-bottom: 2rem;
}

.st-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: .3rem;
  opacity: .8;
}

.st-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}

.st-script {
  font-family: var(--font-script);
  font-size: 3.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

/* Section title + script côte à côte */
.st-row {
  display: flex;
  align-items: flex-end;
  gap: .8rem;
  flex-wrap: wrap;
}

.section-header .section-link {
  font-size: .82rem;
  font-weight: 600;
  color: var(--cyan);
  margin-left: auto;
  padding: .35rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  transition: background var(--t), border-color var(--t);
}
.section-header .section-link:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan);
}

/* ─── CONTENEURS & SECTIONS ─────────────────────── */
.page-section {
  padding: 4rem 1.5rem;
  position: relative;
  z-index: 1;
}

.page-section + .page-section {
  padding-top: 2rem;
}

/* Surface de carte (réutilisable) */
.surface {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

/* ─── SÉPARATEURS STANDARDISÉS ──────────────────── */
/*
 * Règle globale (juin 2026 — tricolore découplé du chrome) :
 *   .hairline   → séparateur cyan dégradé (header + dessus footer)
 *                 NB : ex bande tricolore bleu-blanc-rouge, clashait avec le
 *                 cyan ; le marqueur « Site français » est désormais un petit
 *                 chip discret en bas du footer (.footer-brand::after).
 *   .energy-bar → séparateur cyan dégradé 2px
 *                 usage : toutes les autres séparations inter-section
 *   .section-divider → alias de .energy-bar (classe utilitaire, même style)
 */

/* Séparateur cyan — header et footer */
.hairline {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), rgba(var(--cyan-rgb),.3), transparent);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb),.25);
  margin: 0;
}

/* Doré dégradé — séparations inter-section */
.energy-bar,
.section-divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), rgba(var(--cyan-rgb),.3), transparent);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb),.25);
  margin: 0;
  width: 100%;
}

/* ─── GRILLES PRINCIPALES ────────────────────────── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

/* ─── GRILLE RÉSULTATS RECHERCHE ─────────────────── */
#resultats,
.annonces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
#annonces {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

/* ─── CATÉGORIES (index) ─────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

/* ─── PAGINATION ─────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.5rem 0 1rem;
  flex-wrap: wrap;
}

.pagination button,
.pagination .page-btn {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .75rem;
  border-radius: var(--r-s);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--s1);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t);
}
.pagination button:hover,
.pagination .page-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  background: var(--cyan-dim);
}
.pagination button.active,
.pagination .page-btn.active {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
  font-weight: 700;
}
.pagination button:disabled {
  opacity: .3;
  cursor: not-allowed;
}

/* ─── FOOTER ─────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--cyan), rgba(var(--cyan-rgb),.3), transparent) 1;
  background: var(--s1);
  padding: 3rem 1.5rem 1.5rem;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

.footer-brand .logo {
  font-size: 1.8rem;
  margin-bottom: .5rem;
}

.footer-brand p {
  font-size: .82rem;
  color: var(--muted);
  max-width: 280px;
}

/* Chip « Site français » — marqueur tricolore discret (remplace l'ancienne
   bande pleine largeur qui clashait avec le cyan). Tricolore dessiné en CSS
   (mini-barre verticale 4px à gauche) car l'emoji 🇫🇷 s'affiche « FR » sur
   Windows. Pur CSS → présent sur toutes les pages sans éditer leur footer. */
.footer-brand::after {
  content: "Site français";
  display: inline-flex;
  align-items: center;
  margin-top: 1rem;
  padding: .4rem .9rem .4rem 2.2rem;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    linear-gradient(to right, #1d4ed8 0% 33.33%, #f4f4f4 33.33% 66.66%, #dc2436 66.66% 100%) left .7rem center / 20px 13px no-repeat,
    rgba(var(--cyan-rgb), .06);
}

.footer-links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-col h4 {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: .8rem;
}

.footer-col a {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .4rem;
  transition: color var(--t);
}
.footer-col a:hover { color: var(--cyan); }

.footer-bottom {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(var(--cyan-rgb),.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-bottom p {
  font-size: .75rem;
  color: var(--muted);
}

/* ─── TOASTS / NOTIFICATIONS ─────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: .85rem;
  color: var(--text);
  animation: slideDown var(--t);
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.toast.success { border-color: rgba(var(--cyan-rgb),.4); }
.toast.error   { border-color: rgba(255,80,80,.4); }
.toast.warning { border-color: rgba(255,180,0,.4); }

/* ─── BREADCRUMB ─────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--muted);
  padding: .75rem 0;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--cyan); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); }

/* ─── BANDEAU PWA / INFO ─────────────────────────── */
.pwa-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: linear-gradient(135deg, var(--s2) 0%, rgba(0,50,100,.4) 100%);
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text);
  z-index: calc(var(--z-header) - 1);
}
.pwa-banner[hidden] { display: none; }

.pwa-banner button {
  margin-left: auto;
  padding: .35rem .9rem;
  border-radius: var(--r-s);
  font-size: .8rem;
  font-weight: 600;
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-h);
  transition: background var(--t);
  flex-shrink: 0;
}
.pwa-banner button:hover { background: rgba(var(--cyan-rgb),.25); }

/* Enfants du bandeau PWA (émis par _pwaInjectUI) */
.pwa-banner-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }
.pwa-banner-text { display: flex; flex-direction: column; line-height: 1.3; }
.pwa-banner-text strong { font-size: .9rem; color: var(--text); }
.pwa-banner-text span { font-size: .78rem; color: var(--muted); }
.pwa-banner-cta { display: inline-flex; align-items: center; gap: .4rem; }
.pwa-banner-close {
  margin-left: 0 !important;
  background: none !important;
  border: none !important;
  color: var(--muted) !important;
  font-size: 1.15rem !important;
  font-weight: 400 !important;
  padding: 0 .3rem !important;
  width: auto !important;
}
.pwa-banner-close:hover { color: var(--text) !important; background: none !important; }

/* Modale d'aide installation iOS (émise par _pwaInjectUI, affichée display:flex) */
.pwa-ios-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 9999);
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.pwa-ios-card {
  position: relative;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2rem 1.75rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.pwa-ios-close {
  position: absolute; top: .6rem; right: .6rem;
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.pwa-ios-close:hover { color: var(--text); }
.pwa-ios-icon { width: 64px; height: 64px; border-radius: 14px; margin: 0 auto .75rem; display: block; }
.pwa-ios-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.pwa-ios-card p { font-size: .85rem; color: var(--text-dim); line-height: 1.55; }
.pwa-ios-share { display: inline-flex; align-items: center; color: var(--cyan); font-weight: 700; }
.pwa-ios-hint { margin-top: 1rem; font-size: .78rem; color: var(--muted); }

/* ─── RESPONSIVE LAYOUT ──────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { height: 56px; padding: 0 1rem; }

  nav { display: none; }
  .nav-btn-auth, .nav-btn-deposer { display: none; }
  .hamburger { display: flex; }

  .hero { padding: 3rem 1rem 2.5rem; }

  .grid-4,
  .grid-3  { grid-template-columns: repeat(2, 1fr); }
  .grid-2  { grid-template-columns: 1fr; }

  #resultats,
  #annonces,
  .annonces-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }

  .categories-grid { grid-template-columns: repeat(3, 1fr); }

  .footer-inner  { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .page-section { padding: 2.5rem 1rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }

  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }

  #resultats,
  #annonces,
  .annonces-grid { grid-template-columns: 1fr; }

  .categories-grid { grid-template-columns: repeat(2, 1fr); }

  .hero h1 { font-size: 1.7rem; }
}
