/* ============================================================
   CRESSMA — sites.css
   Styles de l'onglet Sites de plongée (Leaflet + carte)
   ============================================================ */

/* ── LAYOUT CARTE ─────────────────────────────────────────── */
.sites-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── TOOLBAR ──────────────────────────────────────────────── */
.map-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .6rem 1rem;
  background: rgba(10,31,56,.85);
  border-bottom: 1px solid rgba(255,255,255,.12);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-shrink: 0;
}
.sidebar-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #7aa0c0;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-filters { display: flex; gap: .4rem; flex-wrap: wrap; }

.filter-btn {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: #7aa0c0;
  transition: all .15s;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.filter-btn.active {
  background: rgba(34,211,238,.15);
  color: var(--cyan);
  border-color: rgba(34,211,238,.4);
}

/* ── BADGES TYPE ──────────────────────────────────────────── */
.site-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-exploration { background:rgba(34,211,238,.15); color:var(--cyan); border:1px solid rgba(34,211,238,.3); }
.badge-formation   { background:rgba(251,191,36,.15);  color:#fbbf24; border:1px solid rgba(251,191,36,.3); }
.badge-technique   { background:rgba(251,113,133,.15); color:#fb7185; border:1px solid rgba(251,113,133,.3); }

/* ── MAP ──────────────────────────────────────────────────── */
.map-container {
  flex: 1;
  position: relative;
  min-height: 0;
}
#sites-map { width: 100%; height: 100%; }

/* ── POPUP LEAFLET ────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: rgba(6,18,40,.97) !important;
  border: 1px solid rgba(34,211,238,.3) !important;
  border-radius: 12px !important;
  color: var(--text) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.7) !important;
  min-width: 260px !important;
}
.leaflet-popup-content { margin: 14px 16px !important; }
.leaflet-popup-tip { background: rgba(6,18,40,.97) !important; }

.popup-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.15rem;
  color: var(--cyan);
  margin-bottom: .2rem;
  letter-spacing: .04em;
}
.popup-ville  { font-size: .75rem; color: #7aa0c0; margin-bottom: .5rem; }
.popup-desc   {
  font-size: .82rem; color: #7aa0c0; margin-bottom: .6rem;
  line-height: 1.45; border-left: 2px solid rgba(34,211,238,.3); padding-left: .5rem;
}
.popup-section { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid rgba(255,255,255,.07); }
.popup-section-title {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
  color: #7aa0c0; margin-bottom: .3rem;
}
.popup-row { display: flex; gap: .4rem; font-size: .78rem; color: var(--text); margin-bottom: .25rem; line-height: 1.4; }
.popup-row .label { color: #7aa0c0; min-width: 60px; flex-shrink: 0; }
.popup-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.popup-tag  { padding: 2px 8px; border-radius: 4px; font-size: .68rem; background: rgba(34,211,238,.08); color: var(--cyan); border: 1px solid rgba(34,211,238,.2); }
.popup-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* ── FORMULAIRE OVERLAY ───────────────────────────────────── */
.sites-form-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sites-form-overlay.open { display: flex; }
.sites-form-box {
  background: #0a1f38;
  border: 1px solid rgba(34,211,238,.3);
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  /* scroll fluide iOS */
  -webkit-overflow-scrolling: touch;
}
.sites-form-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  color: var(--cyan);
  margin-bottom: 1rem;
  letter-spacing: .06em;
}
.sites-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.sites-form-group { display: flex; flex-direction: column; gap: .3rem; }
.sites-form-group.full { grid-column: 1 / -1; }
.sites-form-group label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7aa0c0;
}
.sites-form-group input,
.sites-form-group select,
.sites-form-group textarea {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  outline: none;
  /* Empêche le zoom auto iOS (font-size >= 16px requis, on surcharge ici) */
  font-size: max(.88rem, 16px);
}
.sites-form-group input:focus,
.sites-form-group select:focus { border-color: var(--cyan); }
.sites-form-group textarea { resize: vertical; min-height: 80px; font-size: max(.88rem, 16px); }
/* Les <option> sont rendues par l'OS — on ne force pas le fond pour éviter
   texte illisible sur Chrome/Android/Safari. On s'assure juste du contraste
   sur les navigateurs qui respectent ces propriétés. */
.sites-form-group select option {
  background: #1a3a5c;
  color: var(--text);
}
.sites-form-btns { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; }

.type-check-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.type-check-label input { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }

/* ── FAB + ────────────────────────────────────────────────── */
.map-add-btn {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34,211,238,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  /* zone tactile suffisante */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── PICK COORDS ──────────────────────────────────────────── */
.sites-pick-hint {
  display: none;
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: rgba(6,18,40,.95);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: .6rem 1.25rem;
  font-size: .85rem;
  color: var(--cyan);
  pointer-events: none;
  white-space: nowrap;
}

/* ── TOAST ────────────────────────────────────────────────── */
.sites-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0e2442;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: .6rem 1.25rem;
  font-size: .85rem;
  color: var(--cyan);
  z-index: 9999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}
.sites-toast.show { opacity: 1; }

/* ── NIVEAUX COULEURS ─────────────────────────────────────── */
.lvl-Bapteme             { color: #4ade80; }
.lvl-N1, .lvl-FN1        { color: #7dd3fc; }
.lvl-N2, .lvl-FN2        { color: #4ade80; }
.lvl-N3, .lvl-FN3,
.lvl-N4, .lvl-FN4        { color: #a78bfa; }
.lvl-E1, .lvl-E2,
.lvl-MF1, .lvl-MF2       { color: #fbbf24; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .map-toolbar { flex-wrap: wrap; gap: .4rem; padding: .5rem .75rem; }
  .sidebar-filters { gap: .3rem; }
  /* Empêche le pinch-zoom sur la carte (Leaflet le gère lui-même) */
  #sites-map { touch-action: none; }
}