/* ============================================================
   LudoSoir – mobile.css  (inclus après app.css)
   Responsive mobile : drawer sidebar, topbar, bottom nav
   Breakpoint principal : 760px
   ============================================================ */

/* ── HAMBURGER BUTTON (visible uniquement mobile) ─────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
  flex-shrink: 0;
  color: var(--ink);
  transition: background .15s;
}
.hamburger:hover { background: var(--border); }
.hamburger svg { display: block; }

@media (max-width: 760px) {
  /* Hamburger : fixé en haut à gauche, dans la zone topbar */
  .hamburger {
    display: flex;
    position: fixed;
    top: 6px;
    left: 8px;
    z-index: 1300; /* au-dessus de tout : Leaflet, overlay, sidebar */
    background: rgba(244,242,239,.95);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
  }

  /* Décaler la topbar pour ne pas chevaucher le hamburger */
  .topbar {
    padding-left: 58px !important;
  }
}

/* ── OVERLAY (fond sombre derrière le drawer) ─────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1100; /* au-dessus de Leaflet (~400-1000) */
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ── CLOSE BUTTON dans la sidebar (mobile uniquement) ──────── */
.sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

/* ── BOTTOM NAV BAR ───────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,.08);
  z-index: 1050; /* au-dessus de Leaflet */
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  /* safe-area pour iPhone avec encoche en bas */
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255,255,255,.5);
  font-size: 10px;
  font-weight: 500;
  min-width: 52px;
  transition: color .15s, background .15s;
  position: relative;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
}
.bn-item:hover,
.bn-item.active { color: #fff; }
.bn-item.active { color: var(--accent2); }
.bn-icon { font-size: 20px; line-height: 1; }
.bn-label { font-size: 9px; letter-spacing: .2px; }
/* bouton + central mis en avant */
.bn-item.bn-create {
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  padding: 8px 14px;
}
.bn-item.bn-create:hover { opacity: .88; }
/* badge sur la cloche */
.bn-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  line-height: 1.4;
}

/* ── MEDIA QUERIES ────────────────────────────────────────── */
@media (max-width: 760px) {

  /* ── Sidebar : devient un drawer ── */
  .sidebar {
    display: flex !important; /* override le display:none de app.css */
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    width: 280px;
    z-index: 1200; /* au-dessus de Leaflet ET de l'overlay */
    position: fixed;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close {
    display: flex;
  }

  /* ── Hamburger visible ── */
  .hamburger {
    display: flex;
  }

  /* ── Bottom nav visible ── */
  .bottom-nav {
    display: flex;
  }

  /* ── Main : padding bas pour la bottom nav ── */
  .main {
    margin-left: 0 !important;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }

  /* ── Topbar : réduire padding, cacher certains éléments ── */
  .topbar {
    padding: 8px 12px;
    padding-left: 58px; /* place pour le hamburger fixe */
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-title {
    font-size: 15px;
  }
  /* Masquer la search bar dans la topbar (trop étroite) */
  .topbar .search-bar {
    display: none;
  }
  /* topbar-right : passe en dessous sur une ligne complète */
  .topbar .topbar-right {
    width: 100%;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  /* Tous les boutons topbar : compacts, touch-friendly */
  .topbar .topbar-right .btn {
    font-size: 12px;
    padding: 6px 12px;
    min-height: 36px;
  }
  /* Masquer uniquement les boutons de connexion/inscription (pages sans topbar-right fonctionnelle) */
  /* Ces boutons sont dans la sidebar sur desktop — sur mobile ils sont dans la bottom nav */
  .topbar .btn-sidebar-auth { display: none; }

  /* ── Content : padding réduit ── */
  .content {
    padding: 14px 12px;
  }

  /* ── Hero banner moins haut ── */
  .hero-banner {
    height: auto;
    padding: 16px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .hero-banner h1 {
    font-size: 20px;
  }
  /* M3 — boutons hero-banner pleine largeur */
  .hero-banner > div:last-child {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .hero-banner > div:last-child .btn {
    flex: 1;
    justify-content: center;
  }

  /* ── C3 — Hero stats organisateur : 4 cols → 2 cols ── */
  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .hero-stats-grid > div {
    border-bottom: 1px solid var(--border);
  }

  /* ── H4 — Stat cards : padding et typos réduites ── */
  .stat-card { padding: 12px 14px; gap: 8px; }
  .stat-icon { width: 36px; height: 36px; font-size: 16px; }
  .stat-num  { font-size: 20px; }
  .stat-lbl  { font-size: 10px; }

  /* ── Mi2 — Touch targets sidebar ── */
  .nav-item  { min-height: 44px; }
  .logout-link { padding: 8px 0; font-size: 13px; display: block; }

  /* ── Cards : padding réduit ── */
  .card-head {
    padding: 14px 16px;
  }

  /* ── Grilles stats 2 cols → 1 col ── */
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  /* ── Formulaires (create event, etc.) ── */
  .form-grid,
  .two-col,
  .three-col {
    grid-template-columns: 1fr !important;
  }

  /* ── Inputs : taille touch-friendly ── */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important; /* évite le zoom auto iOS */
    min-height: 44px;
    padding: 10px 14px;
  }

  /* ── Boutons touch-friendly ── */
  .btn {
    min-height: 40px;
    padding: 9px 16px;
  }

  /* ── Event card footer : stack verticalement ── */
  .ec-footer {
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }
  .ec-join {
    text-align: center;
  }

  /* ── Pagination : wrapping ── */
  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }
  .page-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* ── Messages : input pleine largeur ── */
  .msg-input-row {
    flex-wrap: wrap;
  }

  /* ── Modals : pleine largeur ── */
  .modal-box {
    width: calc(100vw - 24px);
    max-width: 100%;
    padding: 20px 16px;
    margin: 12px;
  }

  /* ── Auth box ── */
  .auth-box {
    padding: 24px 16px;
  }

  /* ── Quick actions : 1 col ── */
  .quick-actions {
    grid-template-columns: 1fr;
  }

  /* ── Explore : filtres en colonne ── */
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-row select,
  .filter-row input {
    width: 100%;
  }

  /* ── M1 — Explore : filtres en colonne, chips scroll horizontal ── */
  .explore-filters-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .explore-filters-bar > div { width: 100%; }
  .explore-filters-bar select { width: 100%; min-height: 44px; font-size: 14px; }
  .filter-chips-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .filter-chips-row::-webkit-scrollbar { display: none; }
  .explore-filters-bar > div:last-child {
    margin-left: 0 !important;
    justify-content: space-between;
  }

  /* ── H1 — Members : filter bar en colonne, chips et select touch-friendly ── */
  .members-filter-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .members-filter-bar .ptype-chips { flex-wrap: wrap; }
  .members-filter-bar > div { width: 100%; }
  .ptype-chip { font-size: 11px; padding: 6px 10px; min-height: 36px; }
  .members-dept-select { width: 100%; padding: 10px 12px; font-size: 14px; min-height: 44px; }

  /* ── M4 — Tab bar organisateur ── */
  .tab-bar { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn  { padding: 10px; font-size: 12px; white-space: nowrap; }

  /* ── M5 — Boutons Accepter/Refuser/Bannir ── */
  .player-row { flex-wrap: wrap; }
  .player-row > div:last-child {
    width: 100%;
    flex-direction: row;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
  }
  .player-row > div:last-child .pl-btn { flex: 1; text-align: center; }

  /* ── M6 — Modal form deux colonnes ── */
  .form-two-col { grid-template-columns: 1fr !important; }

  /* ── H3 — Messages organisateur ── */
  .messages-body { max-height: 260px !important; }
  .reply-bar { flex-wrap: wrap; }

  /* ── H2 — Map : toggle en position fixed natif dans map.php — règle CSS non nécessaire ── */
  #mapInfo { display: none; }

  /* ── M2 — Notifications : barre sélection ── */
  #selectionBar { flex-wrap: wrap; gap: 6px; }
  #selectionBar button { flex: 1; min-width: 120px; font-size: 11px; }
  /* Topbar notifications : textes courts */
  .notif-topbar-btn .btn-label { display: none; }
  /* Actions lot : pleine largeur */
  .notif-batch-actions { flex-direction: column !important; }
  .notif-batch-actions form,
  .notif-batch-actions button { width: 100%; }
  .notif-batch-actions button { justify-content: center; }
  /* Checkboxes toujours visibles en mode tactile */
  .notif-check-wrap { opacity: 1 !important; }

  /* ── Mi3 — Toast au-dessus de la bottom nav ── */
  .toast { bottom: 74px; }

  /* ── P1 — Page profil (édition) ── */
  /* Hero : passer en colonne */
  .profile-hero-inner {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 14px !important;
  }
  .profile-hero-stats {
    width: 100%;
    justify-content: flex-start !important;
  }
  /* Sous-grid pseudo/email dans le formulaire */
  .profile-form-name-grid {
    grid-template-columns: 1fr !important;
  }
  /* Boutons type de profil : 2 par ligne max */
  .profile-type-btns {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
  /* Topbar bouton profil public : texte court */
  .profile-topbar-btn span.label-long  { display: none; }
  .profile-topbar-btn span.label-short { display: inline; }

  /* ── P2 — Page profil public (profil/index.php) ── */
  /* Stats 4 colonnes → 2x2 */
  .profil-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* Hero : infos sous l'avatar */
  .profil-hero-body {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  /* Topbar : masquer texte des boutons action */
  .profil-topbar-actions .btn-label { display: none; }
  .profil-topbar-actions .btn-icon  { display: inline; }

  /* ── Mi1 — nav-label lisible ── */
  .nav-label { font-size: 10px; }

  /* ── Topbar admin (masquée si pas de main.php admin) ── */
  .admin-wrap .as-item {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* ── M3 — Page membres : KPIs 3 colonnes → 1 colonne ── */
@media (max-width: 760px) {
  .members-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* ── P3 — Page présentation ── */
@media (max-width: 760px) {
  .pres-hero .lead {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }
  /* Masquer les <br> sur mobile : le texte refluera naturellement */
  .pres-hero br { display: none; }
  .pres-hero { overflow-x: hidden; }
}

/* ── P4 — Page Mon profil (profile/index.php) hero ── */
@media (max-width: 760px) {
  .profile-hero-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }
  .profile-hero-stats {
    width: 100%;
    justify-content: flex-start !important;
  }
}

/* ── O1 — Page organisateur : topbar compacte ── */
@media (max-width: 760px) {
  /* Masquer les textes longs dans la topbar organisateur */
  .org-btn-long  { display: none; }
  .org-btn-short { display: inline; }
  /* Sous-titre organisateur masqué (trop long) */
  .org-subtitle  { display: none; }
  /* Boutons topbar organisateur : icône seulement, pas flex:1 */
  .org-topbar-actions .btn,
  .org-topbar-actions .status-pill {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ── C1 — Formulaire création soirée ── */
@media (max-width: 760px) {
  /* Grille 2 colonnes principale → 1 colonne */
  .create-top-grid {
    grid-template-columns: 1fr !important;
  }
  /* Grille champs ville/pays + département/date → 1 colonne */
  .create-fields-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── P5 — Mon profil : nom + badge trop grands ── */
@media (max-width: 760px) {
  .profile-hero-row .profile-username {
    font-size: 18px !important;
  }
}

/* ── Petits téléphones (< 380px) ── */
@media (max-width: 380px) {
  .bn-item {
    min-width: 44px;
    padding: 6px 6px;
  }
  .bn-label {
    display: none;
  }
  .bn-icon {
    font-size: 22px;
  }
  .bn-item.bn-create {
    padding: 8px 10px;
  }
}



/* ── Titre hero index/presentation sur très petit écran ── */
@media (max-width: 400px) {
  .pres-hero h1 {
    font-size: 22px !important;
    white-space: normal !important;
    word-break: normal !important;
  }
}
@media (max-width: 760px) {
  .pres-hero h1 {
    font-size: clamp(18px, 6vw, 28px) !important;
    white-space: normal !important;
  }
}

/* ── Sections pleine largeur + contraste thème Braise mobile ── */
@media (max-width: 760px) {
  .sec-white, .sec-bg, .sec-gradient, .pres-hero {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  /* Renforcer le contraste section bg vs body sur thème Braise */
  .sec-bg {
    background: #e5e2dd !important;
  }
  /* Section blanche : légère ombre pour la distinguer */
  .sec-white {
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
  }
}