:root {
  --bg: #090d16;
  --panel: rgba(15, 23, 42, 0.96);
  --card: #1e293b;
  --border: #334155;
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-glow: rgba(244, 63, 94, 0.18);
  --price-reg: #94a3b8;
  --green: #10b981;
  --text: #f8fafc;
  --text-muted: #64748b;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body { 
  font-family: 'Plus Jakarta Sans', sans-serif; 
  background: var(--bg); 
  color: var(--text); 
  height: 100vh; 
  display: flex; 
  overflow: hidden; 
  position: relative;
}

/* ============================================================================
   1. DESKTOP LAYOUT (SPLIT SCREEN)
   ============================================================================ */
#map-container { 
  flex: 1; 
  height: 100vh; 
  position: relative; 
  contain: layout size style;
}

#map { 
  width: 100% !important; 
  height: 100vh !important;
}

#side-panel {
  width: 470px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: -12px 0 35px rgba(0,0,0,0.7);
  contain: layout paint;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
  position: relative;
}

.panel-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================================
   2. TOP FILTER BAR (DESKTOP)
   ============================================================================ */
.top-filter-bar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 490px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.top-filter-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.logo { 
  font-size: 14px; 
  font-weight: 800; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  white-space: nowrap; 
}

.logo-tag { 
  background: var(--accent); 
  color: white; 
  padding: 2px 6px; 
  border-radius: 4px; 
  font-size: 10px; 
  font-weight: 700; 
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 250px;
}

input[type="range"].pure-red-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: #334155;
  outline: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

input[type="range"].pure-red-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--accent);
  transition: transform 0.1s ease;
}

input[type="range"].pure-red-slider::-webkit-slider-thumb:hover { 
  transform: scale(1.3); 
}

.price-tag-rect {
  background: var(--accent-glow);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 46px;
  text-align: center;
  white-space: nowrap;
}

#extra-filters-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
  margin-top: 0;
}

#extra-filters-panel.open {
  max-height: 70px;
  opacity: 1;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.filter-tags-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tags-scroll::-webkit-scrollbar { display: none; }

/* ============================================================================
   3. COMPONENTS & CARDS
   ============================================================================ */
.search-bar-wrapper { 
  position: relative; 
  margin-bottom: 4px; 
}

.search-bar-wrapper input { 
  padding-left: 36px; 
  padding-right: 32px; 
  margin-bottom: 0; 
  border-radius: 8px; 
  background: #131b2e; 
}

.search-icon { 
  position: absolute; 
  left: 12px; 
  top: 50%; 
  transform: translateY(-50%); 
  width: 14px; 
  height: 14px; 
  fill: var(--text-muted); 
  pointer-events: none; 
}

.search-clear-btn { 
  position: absolute; 
  right: 10px; 
  top: 50%; 
  transform: translateY(-50%); 
  background: none; 
  border: none; 
  color: var(--text-muted); 
  cursor: pointer; 
  font-size: 14px; 
  display: none; 
}
.search-clear-btn:hover { color: var(--text); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.subtitle { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

.badge {
  display: inline-flex; 
  align-items: center; 
  gap: 5px; 
  font-size: 11px; 
  font-weight: 700;
  padding: 3px 8px; 
  border-radius: 6px; 
  background: var(--accent-glow); 
  color: var(--accent);
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.badge-green { background: rgba(16, 185, 129, 0.15); color: var(--green); border-color: rgba(16, 185, 129, 0.3); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

.tag-pill {
  background: #0f172a; 
  border: 1px solid var(--border); 
  color: var(--text-muted);
  padding: 5px 12px; 
  border-radius: 6px; 
  font-size: 11px; 
  font-weight: 600;
  cursor: pointer; 
  transition: 0.15s; 
  white-space: nowrap; 
  user-select: none; 
  display: inline-flex; 
  align-items: center; 
  gap: 5px;
}
.tag-pill:hover { border-color: var(--text); color: var(--text); }
.tag-pill.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.bar-summary-card {
  background: #0f172a; 
  border: 1px solid var(--border); 
  border-radius: 8px; 
  padding: 12px 14px;
  cursor: pointer; 
  transition: 0.15s; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  gap: 12px;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: layout style paint;
}
.bar-summary-card:hover { border-color: var(--accent); background: #141f36; }
.bar-summary-left { flex: 1; overflow: hidden; }
.bar-summary-name { font-weight: 700; font-size: 14px; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-summary-address { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-summary-badges { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.bar-summary-rating { font-size: 11px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 3px; }
.bar-summary-right { text-align: right; white-space: nowrap; }

/* Image Slider */
.slider-container {
  position: relative; 
  width: 100%; 
  height: 180px; 
  border-radius: 8px;
  overflow: hidden; 
  margin-bottom: 12px; 
  border: 1px solid var(--border);
}
.slider-track {
  display: flex; 
  width: 100%; 
  height: 100%; 
  overflow-x: auto;
  scroll-snap-type: x mandatory; 
  scrollbar-width: none;
}
.slider-track::-webkit-scrollbar { display: none; }
.slider-slide { 
  flex: 0 0 100%; 
  height: 100%; 
  scroll-snap-align: start; 
  position: relative; 
}
.slider-slide img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}
.slider-dots { 
  position: absolute; 
  bottom: 8px; 
  left: 0; 
  right: 0; 
  display: flex; 
  justify-content: center; 
  gap: 6px; 
  pointer-events: none; 
}
.slider-dot { 
  width: 6px; 
  height: 6px; 
  border-radius: 50%; 
  background: rgba(255,255,255,0.4); 
}
.slider-dot.active { background: #fff; }

label { 
  font-size: 11px; 
  font-weight: 700; 
  color: var(--text-muted); 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  margin-bottom: 5px; 
  display: block; 
}

input, textarea, select {
  width: 100%; 
  background: #090d16; 
  border: 1px solid var(--border); 
  border-radius: 6px;
  padding: 9px 11px; 
  color: white; 
  font-size: 13px; 
  margin-bottom: 10px; 
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: center; }
.row > div { flex: 1; }

.autocomplete-wrapper { position: relative; }
.autocomplete-list { 
  position: absolute; 
  top: 100%; 
  left: 0; 
  right: 0; 
  background: #0f172a; 
  border: 1px solid var(--border); 
  border-radius: 6px; 
  max-height: 160px; 
  overflow-y: auto; 
  z-index: 2000; 
}
.autocomplete-item { 
  padding: 9px 11px; 
  font-size: 12px; 
  cursor: pointer; 
  border-bottom: 1px solid rgba(255,255,255,0.05); 
}
.autocomplete-item:hover { background: #1e293b; color: var(--accent); }

.btn { 
  display: inline-flex; 
  justify-content: center; 
  align-items: center; 
  width: 100%; 
  padding: 10px; 
  border-radius: 6px; 
  font-size: 13px; 
  font-weight: 700; 
  cursor: pointer; 
  border: none; 
  transition: 0.15s; 
  gap: 8px; 
}
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: white; }
.btn-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; }
.btn-danger:hover { background: #ef4444; color: white; }

.user-pill {
  display: flex; align-items: center; gap: 10px; background: #0f172a; padding: 6px 14px 6px 8px;
  border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
}
.user-pill:hover { border-color: var(--accent); }
.avatar { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; color: white; }

.pin-marker { 
  background: var(--accent); 
  width: 30px; 
  height: 30px; 
  border-radius: 50%; 
  border: 2px solid #ffffff; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.5); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
}
.pin-marker svg { width: 14px; height: 14px; fill: white; }

.modal-backdrop { 
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.75); 
  backdrop-filter: blur(5px); 
  -webkit-backdrop-filter: blur(5px);
  z-index: 3000; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}
.modal-card { 
  background: #1e293b; 
  border: 1px solid var(--border); 
  padding: 24px; 
  border-radius: 10px; 
  width: 90%; 
  max-width: 420px; 
  text-align: center; 
}

.hidden { display: none !important; }

/* Performance & Scroll Optimization */
#bars-summary-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  contain: layout paint !important;
  overflow-anchor: none;
  transform: translateZ(0);
  will-change: scroll-position;
}

img {
  max-width: 100%;
  height: auto;
  content-visibility: auto;
}

/* ============================================================================
   4. MOBILE RESPONSIVE VERSION (BOTTOM SHEET & COMPACT TOP BAR)
   ============================================================================ */
.mobile-filter-toggle {
  display: none;
}

@media (max-width: 768px) {
  /* Map takes full screen behind */
  #map-container {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
  }

  #map {
    width: 100% !important;
    height: 100vh !important;
  }

  /* Compact floating top bar */
  .top-filter-bar {
    left: 10px !important;
    right: 10px !important;
    top: 10px !important;
    padding: 8px 12px !important;
    gap: 6px;
  }

  .top-filter-main-row {
    gap: 8px;
  }

  .slider-wrapper {
    max-width: 130px !important;
  }

  /* Mobile filter toggle button */
  .mobile-filter-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
  }

  .mobile-filter-toggle.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
  }

  /* Side panel transforms into a bottom sheet */
  #side-panel {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: calc(100vh - 75px) !important; /* Laisse juste la place de voir la barre du haut */
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  z-index: 1500;
  box-shadow: 0 -15px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* Replié par défaut : on ne voit que l'en-tête */
  transform: translateY(calc(100% - 75px));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  contain: layout paint;
}

#side-panel.expanded {
  transform: translateY(0);
}

.panel-content {
  padding: 16px 16px 40px 16px; /* Espace confortable en bas pour les formulaires */
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

  /* Pull handle for bottom sheet */
  .panel-header {
    cursor: pointer;
    position: relative;
    padding-top: 20px;
  }
  
  .panel-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
  }
}
/* ============================================================================
   STYLE UNIFIÉ DES BOUTONS D'ACTION ET DE SUPPRESSION (FORMULAIRES)
   ============================================================================ */

/* Boutons d'ajout de bières, pastis et snacks */
.btn-add-highlight {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #f8fafc;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-add-highlight:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

/* Boutons de suppression de ligne (croix rouge stylisée) */
.btn-delete-row {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.15s ease;
}
.btn-delete-row:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Boutons de créneaux et de fermeture de jour */
.btn-close-day {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-close-day:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #f1f5f9;
}

.btn-remove-slot {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  margin-left: 4px;
}
.btn-remove-slot:hover {
  background: #ef4444;
  color: white;
}