/* ═══════════════════════════════════════════════════════
   FISHLOG — Mobile-first stylesheet
   Cible : 360–420 px portrait, accessible au pouce
   ═══════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────
   BOTTOM NAVIGATION (rendu uniquement sur mobile)
   ──────────────────────────────────────────────────────── */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9000;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0,0,0,.14);
  align-items: stretch;
}

.mn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text3);
  border: none;
  background: none;
  cursor: pointer;
  padding: 6px 2px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  font-family: inherit;
}
.mn-item:hover,
.mn-item.active { color: var(--accent-carpe, var(--accent, #3a9e5a)); }
.mn-icon  { font-size: 1.25rem; line-height: 1; }
.mn-label { font-size: .56rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60px; }
.mn-notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; border-radius: 999px;
  background: #e03535; color: #fff;
  font-size: .6rem; font-weight: 800; line-height: 16px;
  display: none; align-items: center; justify-content: center;
  padding: 0 3px; pointer-events: none;
}
.mn-item { position: relative; }

/* ── Session picker (bottom sheet) ── */
#mn-session-sheet { display: none; position: fixed; inset: 0; z-index: 9001; }
#mn-session-sheet.open { display: block; }
.mn-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.mn-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 32px rgba(0,0,0,.2);
}
.mn-sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 16px;
}
.mn-sheet-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text3); text-align: center; margin-bottom: 14px;
}
.mn-session-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mn-session-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 16px 10px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--surface2);
  text-decoration: none; color: var(--text); cursor: pointer;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
  min-height: 80px; justify-content: center;
}
.mn-session-btn:active { transform: scale(.96); }
.mn-session-icon { font-size: 1.7rem; }
.mn-session-name { font-size: .82rem; font-weight: 700; }


/* ════════════════════════════════════════════════════════
   MEDIA QUERY — MOBILE (≤ 768 px)
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Activation bottom nav ── */
  #mobile-nav { display: flex !important; }

  /* ── Compensation hauteur bottom nav ── */
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important; }

  /* ── Taille de police minimum ── */
  body { font-size: 15px; }

  /* Empêche le zoom iOS sur focus input (min 16px) */
  input, select, textarea, [contenteditable] { font-size: 16px !important; }

  /* ── Tap targets : 44 px minimum ── */
  button, .btn, [role="button"],
  .tab, .filter-pill, .ctrl-btn {
    min-height: 44px;
  }

  /* ── Grilles → colonne unique ── */
  .fish-grid, .tools-grid, .hunt-grid,
  .form-grid, .form-grid.thirds, .form-grid.halves {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* ── Éléments cachés sur mobile ── */
  .desktop-only { display: none !important; }

  /* ── Éléments cachés sur desktop seulement sur mobile ── */
  .mobile-only { display: block !important; }

  /* ────────────────────────────────────────────────────
     HEADER des carnets de session
  ──────────────────────────────────────────────────── */
  header { padding: 20px 16px 16px !important; }
  .header-title { font-size: 1.3rem !important; }
  header p { font-size: .84rem; }

  /* ────────────────────────────────────────────────────
     ACTIONS BAR (boutons + sélecteur user)
  ──────────────────────────────────────────────────── */
  .actions-bar {
    padding: 6px 10px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .actions-bar::-webkit-scrollbar { display: none; }
  .actions-bar .btn { padding: 6px 12px; font-size: .78rem; white-space: nowrap; flex-shrink: 0; }

  /* ────────────────────────────────────────────────────
     ONGLETS SESSION
  ──────────────────────────────────────────────────── */
  .tabs-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs-wrap::-webkit-scrollbar { display: none; }
  .tabs { padding: 0 8px !important; }
  .tab { padding: 12px 14px !important; font-size: .8rem !important; min-height: 44px; }
  .tab-icon { font-size: .95rem; }

  /* ────────────────────────────────────────────────────
     FORMULAIRES (session, captures)
  ──────────────────────────────────────────────────── */
  .form-group label { font-size: .8rem; }
  .form-group input,
  .form-group select,
  .form-group textarea { padding: 10px 12px !important; border-radius: 8px !important; }
  textarea { min-height: 80px; }

  /* ────────────────────────────────────────────────────
     CAPTURES / CARDS
  ──────────────────────────────────────────────────── */
  .capture-card, .fish-card, .hunt-card, .card {
    width: 100% !important;
    margin-left: 0 !important; margin-right: 0 !important;
  }

  /* ────────────────────────────────────────────────────
     TABLEAUX → scroll horizontal
  ──────────────────────────────────────────────────── */
  .table-wrap, .hourly-wrap, .daily-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* ────────────────────────────────────────────────────
     INDEX — fish-card
  ──────────────────────────────────────────────────── */
  .fish-card, .hunt-card {
    flex-direction: row !important;
    align-items: center !important;
    padding: 14px !important;
    gap: 14px !important;
  }
  .card-illus {
    width: 56px !important; height: 56px !important;
    flex-shrink: 0;
    border-radius: 12px;
  }
  .card-body { flex: 1; }
  .card-stripe { width: 100% !important; height: 4px !important; }
  .card-tags { display: none; } /* trop encombrant sur mobile */
  .card-sci { display: none; }

  /* ────────────────────────────────────────────────────
     INDEX — header
  ──────────────────────────────────────────────────── */
  .brand-name { font-size: 2rem !important; }
  .brand-tagline { font-size: .62rem !important; }
  .chasselog-link, .fishlog-link { font-size: .68rem !important; padding: 4px 10px !important; }
  header p { display: none; } /* tagline sous le titre masquée sur mobile */
  .divider-ornament { display: none; }
  .wave { display: none; }

  /* ────────────────────────────────────────────────────
     INDEX — section labels + user bar
  ──────────────────────────────────────────────────── */
  .section-group-label { font-size: .68rem; margin: 16px 0 8px; }

  /* ────────────────────────────────────────────────────
     CARTE — bottom nav se superpose, map doit être full
  ──────────────────────────────────────────────────── */
  #map-wrap { height: calc(100vh - 48px - env(safe-area-inset-bottom, 0px)) !important; }
  .style-switcher { bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 10px) !important; }
  .mode-switcher   { top: 8px !important; }
  .exag-panel      { top: 52px !important; }
  .maplibregl-ctrl-top-right { top: 50px !important; }

  /* ────────────────────────────────────────────────────
     FILTER PILLS (carte, dashboard)
  ──────────────────────────────────────────────────── */
  .filter-bar {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important; scrollbar-width: none; padding: 4px 10px !important;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-pill { flex-shrink: 0; font-size: .7rem !important; }

  /* ────────────────────────────────────────────────────
     TOPBAR (carte)
  ──────────────────────────────────────────────────── */
  .topbar { padding: 0 10px !important; }
  .topbar-title { font-size: .9rem !important; }
  .ctrl-btn { padding: 4px 8px !important; font-size: .68rem !important; }

  /* ────────────────────────────────────────────────────
     PORTAIL (index.html racine)
  ──────────────────────────────────────────────────── */
  .carnet-tabs { flex-direction: column !important; gap: 8px !important; }
  .carnet-tab { padding: 12px !important; flex-direction: row !important; gap: 10px !important; align-items: center !important; }
  .access-cards { flex-direction: column !important; }
  .main { padding: 0 12px; }

  /* ────────────────────────────────────────────────────
     DASHBOARD (bilan, stats)
  ──────────────────────────────────────────────────── */
  .dashboard-grid,
  .stat-grid,
  .kpi-row { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .kpi-card, .stat-card { padding: 12px !important; }

  /* ────────────────────────────────────────────────────
     PARTICIPANTS CHIPS
  ──────────────────────────────────────────────────── */
  .participants-chips { gap: 8px !important; }
  .participant-chip { font-size: .82rem !important; padding: 8px 12px !important; }

  /* ────────────────────────────────────────────────────
     NO-ZOOM sur les inputs spéciaux
  ──────────────────────────────────────────────────── */
  input[type="color"]  { height: 44px !important; }
  input[type="range"]  { height: 32px !important; }
  input[type="checkbox"],
  input[type="radio"]  { width: 20px !important; height: 20px !important; }

}

/* ── Helpers globaux (visibles partout) ── */
.mobile-only { display: none; }

/* ────────────────────────────────────────────────────────
   QUICK CAPTURE — FAB + bottom sheet
   ──────────────────────────────────────────────────────── */
#qc-fab {
  display: none;
  position: fixed;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 14px);
  right: 16px;
  z-index: 8998;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--accent-carpe, #3a9e5a);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
#qc-fab:active { transform: scale(.91); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

#qc-sheet { display: none; position: fixed; inset: 0; z-index: 9003; }
#qc-sheet.open { display: block; }
.qc-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.qc-inner {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 32px rgba(0,0,0,.2);
}
.qc-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 16px; }
.qc-title { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); text-align: center; margin-bottom: 18px; }
.qc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.qc-field label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text3); margin-bottom: 6px; }
.qc-field input {
  width: 100%; padding: 14px 10px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface2); color: var(--text);
  font-size: 1.15rem; font-weight: 700; text-align: center; box-sizing: border-box;
  font-family: inherit;
}
.qc-field input:focus { outline: none; border-color: var(--accent-carpe, #3a9e5a); box-shadow: 0 0 0 3px rgba(58,158,90,.15); }
.qc-save {
  width: 100%; padding: 15px; border-radius: 12px;
  background: var(--accent-carpe, #3a9e5a); color: #fff;
  border: none; font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent; transition: transform .12s;
}
.qc-save:active { transform: scale(.97); }

@media (max-width: 768px) {
  #qc-fab { display: flex !important; }
}
