/* ============================================================
   STOV TRAVEL — mobile.css
   Optimisation complète smartphones & tablettes
   ============================================================ */

/* ── SAFE AREA (iPhone notch / Dynamic Island / Android) ─── */
:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --drawer-width: 300px;
}

/* ── TOUCH : supprime le délai 300ms sur mobile ─────────── */
* { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, textarea, select, button { touch-action: manipulation; }

/* ── NAVBAR : ajustement safe-area haut ────────────────── */
#main-nav {
  padding-top: calc(0px + var(--safe-top));
  height: calc(62px + var(--safe-top));
  padding-left: calc(24px + var(--safe-left));
  padding-right: calc(24px + var(--safe-right));
}

/* ── HAMBURGER BUTTON ────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s;
}
.nav-hamburger:hover { background: rgba(255,255,255,0.15); }
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s, width 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE OVERLAY ─────────────────────────────────────── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 198;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-overlay.open { display: block; opacity: 1; }

/* ── MOBILE DRAWER ──────────────────────────────────────── */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  max-width: 85vw;
  background: var(--midnight);
  z-index: 199;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-bottom: var(--safe-bottom);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 4px 0 40px rgba(0,0,0,0.4);
}
.mobile-drawer.open { transform: translateX(0); }

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.mobile-drawer-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.mobile-drawer-close:hover { background: rgba(255,255,255,0.15); }

.mobile-drawer-nav {
  flex: 1;
  padding: 12px 0;
}
.mobile-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border-radius: 0;
  line-height: 1.4;
}
.mobile-nav-item:hover,
.mobile-nav-item:active { background: rgba(201,150,59,0.12); color: var(--gold-light); }

.mobile-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.mobile-auth { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mobile-user-info { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

/* ── TABLETTE : 768px – 1024px ───────────────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
  .nav-links .nav-link { font-size: 12px; padding: 5px 9px; }
  .nav-actions { gap: 6px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  #lang-selector-wrap select,
  #lang-selector-wrap .lang-btn { font-size: 11px; }
}

/* ── SMARTPHONE + PETITE TABLETTE : ≤ 768px ─────────────── */
@media (max-width: 768px) {
  /* Hamburger visible */
  .nav-hamburger { display: flex; }

  /* Cacher les liens desktop et boutons */
  .nav-links { display: none !important; }
  #nav-public-btns { display: none !important; }
  #nav-user-area { display: none !important; }
  #lang-selector-wrap { display: none; }

  /* Pages : min-height avec safe-area */
  .page { min-height: calc(100vh - 62px - var(--safe-top)); }

  /* Hero slider : plus compact */
  .hero-slider { min-height: 380px !important; }
  .hero-slider .slider-slide { min-height: 380px !important; }
  .hero-inner { padding: 2.5rem 1.2rem !important; }

  /* Sections */
  .section { padding: 40px 0; }
  .container { padding: 0 16px; }
  .container-full { padding: 0 16px; }

  /* Search box */
  .search-box { margin: 0 -8px; border-radius: 12px; padding: 16px; }
  .trip-tabs { flex-wrap: wrap; gap: 4px; }
  .trip-tabs button { font-size: 12px; padding: 6px 10px; }
  .search-fields { flex-direction: column; gap: 10px; }
  .sf-group { min-width: 100%; }
  .sf-input { font-size: 16px !important; } /* prevent iOS zoom */

  /* Formulaire devis */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-group.full { grid-column: 1; }
  input, select, textarea {
    font-size: 16px !important; /* prevent iOS zoom on focus */
  }

  /* Grilles destinations */
  .dest-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .dest-card { border-radius: 10px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr !important; gap: 24px; }

  /* KPI back-office */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Paiements */
  .paiement-options { flex-direction: column; }
  .mensuel-banner-inner { flex-direction: column; text-align: center; gap: 12px; }

  /* Back-office header */
  .back-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .back-panel { padding: 12px; }

  /* Page headers */
  .page-header { padding: 32px 0 24px; }
  .page-header h1 { font-size: 26px; }

  /* Tableaux : scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }

  /* Modales : full width sur mobile */
  .modal-box,
  [id$="-modal"] .modal-box,
  .modal .modal-box {
    width: calc(100vw - 32px);
    max-width: 100%;
    margin: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Cards partenaires */
  .partners-grid,
  .partenaires-grid { grid-template-columns: 1fr !important; gap: 14px; }

  /* Slider dots : plus facile à toucher */
  .slider-dot {
    width: 10px !important;
    height: 10px !important;
    cursor: pointer;
  }

  /* CTA boutons : pleine largeur sur mobile */
  .hero-cta { flex-direction: column; gap: 10px; }
  .hero-cta .btn { width: 100%; justify-content: center; }

  /* Upload zone */
  .upload-zone { padding: 1.2rem 0.8rem; }

  /* Alerte toast */
  #toast-global { bottom: calc(20px + var(--safe-bottom)); right: 16px; left: 16px; max-width: 100%; }
}

/* ── TRÈS PETIT (≤ 380px) ─────────────────────────────────── */
@media (max-width: 380px) {
  .hero-inner h1,
  .hero-title { font-size: clamp(1.5rem, 7vw, 2rem) !important; }
  .dest-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .nav-logo { font-size: 16px; }
  .nav-moon { font-size: 18px; }
  .section { padding: 28px 0; }
  .container { padding: 0 12px; }
}

/* ── PAYSAGE SMARTPHONE (landscape) ──────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-slider { min-height: 260px !important; }
  .hero-slider .slider-slide { min-height: 260px !important; }
  .hero-inner { padding: 1.5rem 1.2rem !important; }
  .mobile-drawer {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── TABLETTE PORTRAIT (iPad, etc.) ───────────────────────── */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .dest-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ── SCROLLBAR : mobile slim ─────────────────────────────── */
@media (max-width: 768px) {
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(201,150,59,0.4); border-radius: 4px; }
}

/* ── FOCUS : plus visible sur mobile ─────────────────────── */
@media (max-width: 768px) {
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
}

/* ── BOTTOM NAV : barre de navigation mobile optionnelle ─── */
/* (réservé pour version future) */

/* ── ANIMATIONS : réduit si l'utilisateur préfère ────────── */
@media (prefers-reduced-motion: reduce) {
  .mobile-drawer,
  .mobile-overlay,
  .nav-hamburger span { transition: none !important; }
}

/* ── LOGO IMAGE ─────────────────────────────────────────── */
.nav-logo { gap: 0 !important; }
.nav-logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.3));
  transition: opacity 0.2s;
}
.nav-logo:hover .nav-logo-img { opacity: 0.85; }

@media (max-width: 768px) {
  .nav-logo-img { height: 34px; }
}
