﻿/* ==========================================================================
   UI Drawer (Menu burger) - styles
   Objectif: rendu moderne, cohérent avec l'app, optimisé pouce (mobile-first)
   ========================================================================== */

/* ✅ Le bandeau "secteur / code postal" n'a pas d'intérêt -> on le masque */
#sector-panel {
  display: none !important;
}

/* ✅ On s’assure que le bouton burger reste cliquable au-dessus de la carte */
#hud {
  z-index: 5000 !important;
  top: calc(12px + env(safe-area-inset-top, 0px)) !important;
  left: 12px !important;
}

#btn-menu {
  z-index: 6000 !important;
  position: relative !important;
}

/* --------------------------------------------------------------------------
   Backdrop (fond sombre quand le menu est ouvert)
   -------------------------------------------------------------------------- */
.ui-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 7000;
}

.ui-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Drawer container
   -------------------------------------------------------------------------- */
.ui-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;

  width: 86vw;
  max-width: 420px;

  /* Cohérence avec la carte (style "card") */
  background: var(--card, rgba(255, 255, 255, 0.9));
  border: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  box-shadow: var(--shadow, 0 14px 40px rgba(0, 0, 0, 0.16));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Arrondi côté droit uniquement (effet "volet") */
  border-radius: 0 var(--radius, 18px) var(--radius, 18px) 0;

  transform: translateX(-103%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);

  z-index: 8000;
  display: flex;
  flex-direction: column;
}

.ui-drawer.open {
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.ui-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 12px 14px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
}

.ui-drawer-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--ink, #111);
}

/* ✅ On copie le style EXACT de .icon-btn (map.css) pour la cohérence */
.ui-drawer-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  box-shadow: var(--shadow2, 0 10px 22px rgba(0, 0, 0, 0.12));
  color: var(--ink, #111);

  font-weight: 900;
  font-size: 20px;
  line-height: 1;

  cursor: pointer;
  user-select: none;

  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  touch-action: manipulation;
}

.ui-drawer-close:active {
  transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   Body + sections
   -------------------------------------------------------------------------- */
.ui-drawer-body {
  padding: 12px 12px 16px 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.ui-drawer-section {
  margin-top: 16px;
}

.ui-drawer-section:first-child {
  margin-top: 4px;
}

.ui-drawer-section h3 {
  margin: 0 0 10px 2px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   Items (touch-friendly)
   -------------------------------------------------------------------------- */
.ui-drawer-item {
  width: 100%;
  min-height: 52px;

  padding: 0 14px;

  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow2, 0 10px 22px rgba(0, 0, 0, 0.12));

  display: flex;
  align-items: center;

  font-size: 16px;
  font-weight: 800;
  color: var(--ink, #111);

  cursor: pointer;
  user-select: none;
  touch-action: manipulation;

  transition:
    transform 0.12s ease,
    filter 0.12s ease;
}

/* petit chevron discret à droite (donne un aspect "app") */
.ui-drawer-item::after {
  content: "›";
  margin-left: auto;
  font-size: 22px;
  opacity: 0.45;
  transform: translateY(-1px);
}

.ui-drawer-item:hover {
  filter: brightness(0.99);
}

.ui-drawer-item:active {
  transform: scale(0.99);
}

/* ======================================================================
   FIX — TEXTE "Aller à une adresse"
   ====================================================================== */

#menu-go-address .ms-3 {
  flex: 1;
}

/* ======================================================================
   MENU PROSPECTION — GROUPE COMPACT + PUCE (MODERNE)
   ====================================================================== */

/* 1) Regrouper les sous-items (réduit l'écart créé par "space-y-2") */
#prospection-submenu {
  margin-left: 14px;
}

#prospection-hotspots-submenu {
  margin-left: 14px;
}

#prospection-submenu > :not([hidden]) ~ :not([hidden]) {
  margin-top: 2px !important;
}

/* 2) Lignes plus fines et plus "app" */
#prospection-submenu a {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  border-radius: 10px !important;
  font-weight: 400 !important;

  /* Bandeau gris permanent + bord ultra-fin prêt (sans bouger la mise en page) */
  background: rgba(15, 23, 42, 0.05) !important;
  border: 1px solid transparent !important;
}

/* 3) Hover très léger (pro, pas un gros bandeau) */
#prospection-submenu a:hover {
  background: rgba(15, 23, 42, 0.05) !important;
  border-color: currentColor !important;
}

#prospection-submenu a:active {
  border-color: currentColor !important;
}

#prospection-submenu a:focus {
  border-color: currentColor !important;
}

#prospection-submenu a.is-active {
  border-color: currentColor !important;
}

/* 4) Petite puce à gauche (hiérarchie + classe) */
#prospection-submenu a::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.95;
  flex: 0 0 auto;
}

#prospection-hotspots-submenu .hotspots-menu-link::before {
  content: none !important;
}

/* 5) Ajuste l'espacement texte (ms-3 Tailwind est un peu large) */
#prospection-submenu a .ms-3 {
  margin-left: 10px !important;
}

/* 6) Couleurs (texte + puce) */
#menu-prospection {
  color: #f59e0b !important;
}

#menu-prospection-opps {
  color: #ef4444 !important;
}

#menu-prospection-hotspots {
  color: #ef4444 !important;
}

#menu-hotspots-map {
  color: #ef4444 !important;
}

#menu-hotspots-list {
  color: #ef4444 !important;
}

#menu-prospection-flyers {
  color: #7c3aed !important;
}

.ui-drawer-sub {
  margin: 8px 2px 0 2px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1.35;
}

/* Footer léger */
.ui-drawer-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

/* Responsive: sur grand écran, on limite la largeur */
/* ======================================================================
   FIX FLOWBITE — TEXTE MENU BURGER
   (force l'affichage du texte après l'icône)
   ====================================================================== */

#drawer-navigation a span.ms-3 {
  display: inline-block;
  margin-left: 12px;
  white-space: nowrap;
}
#prospection-hotspots-submenu {
  margin-left: 14px;
  padding-top: 2px;
}

#prospection-hotspots-submenu > * + * {
  margin-top: 4px;
}

/* ======================================================================
   POINTS CHAUDS — sous-lignes minimalistes (mobile-first)
   ====================================================================== */

#prospection-hotspots-submenu .hotspots-menu-row,
#prospection-hotspots-submenu .hotspots-menu-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 4px 2px 4px 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #ef4444 !important;
  text-decoration: none !important;
  font: inherit;
  text-align: left;
  user-select: none;
  touch-action: manipulation;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

#prospection-hotspots-submenu .hotspots-menu-row:hover,
#prospection-hotspots-submenu .hotspots-menu-row:active,
#prospection-hotspots-submenu .hotspots-menu-row:focus,
#prospection-hotspots-submenu .hotspots-menu-link:hover,
#prospection-hotspots-submenu .hotspots-menu-link:active,
#prospection-hotspots-submenu .hotspots-menu-link:focus,
#prospection-hotspots-submenu .hotspots-menu-link.is-active {
  background: transparent !important;
  border-color: transparent !important;
  filter: none !important;
  outline: none !important;
  transform: none !important;
}

#prospection-hotspots-submenu .hotspots-menu-link.is-tapped {
  opacity: 0.72;
  transform: translateY(1px) !important;
}

#prospection-hotspots-submenu .hotspots-menu-row .ms-3,
#prospection-hotspots-submenu .hotspots-menu-link .ms-3 {
  display: inline-block;
  margin-left: 12px;
  white-space: nowrap;
  min-width: 0;
}

#prospection-hotspots-submenu .hotspots-menu-row svg,
#prospection-hotspots-submenu .hotspots-menu-link svg {
  flex: 0 0 auto;
}

#prospection-hotspots-submenu .hotspots-menu-switch {
  margin-left: auto;
  margin-right: 2px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

#prospection-hotspots-submenu .hotspots-menu-switch label {
  display: inline-block;
  vertical-align: middle;
  touch-action: manipulation;
  cursor: pointer;
}

/* ======================================================================
   POINTS CHAUDS — switch Carte (réutilise le switch existant, sans pill)
   ====================================================================== */

#menu-hotspots-map
  .switch-toggle
  input[type="checkbox"]:checked
  + label::before {
  left: 36px;
  content: "ON";
  color: #fff;
  background-color: #ef4444;
  box-shadow:
    -2px -2px 4px rgba(255, 255, 255, 0.22),
    2px 2px 8px rgba(239, 68, 68, 0.55);
}

/* ======================================================================
   FLYERS & DEMANDES — sous-lignes (même style que Points chauds)
   ====================================================================== */

#prospection-flyers-submenu {
  margin-left: 14px;
  padding-top: 2px;
}

#prospection-flyers-submenu > * + * {
  margin-top: 4px;
}

#prospection-flyers-submenu .hotspots-menu-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 4px 2px 4px 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #7c3aed !important;
  text-decoration: none !important;
  font: inherit;
  text-align: left;
  user-select: none;
  touch-action: manipulation;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

#prospection-flyers-submenu .hotspots-menu-link:hover,
#prospection-flyers-submenu .hotspots-menu-link:active,
#prospection-flyers-submenu .hotspots-menu-link:focus {
  background: transparent !important;
  border-color: transparent !important;
  filter: none !important;
  outline: none !important;
  opacity: 0.75;
}

#prospection-flyers-submenu .hotspots-menu-link .ms-3 {
  display: inline-block;
  margin-left: 12px;
  white-space: nowrap;
  min-width: 0;
}

#prospection-flyers-submenu .hotspots-menu-link svg {
  flex: 0 0 auto;
}

/* ======================================================================
   STATISTIQUES — sous-lignes (même style que Points chauds / Flyers)
   ====================================================================== */

#stats-submenu {
  margin-left: 14px;
  padding-top: 2px;
}

#stats-submenu > * + * {
  margin-top: 4px;
}

#stats-submenu .hotspots-menu-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 4px 2px 4px 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-decoration: none !important;
  font: inherit;
  text-align: left;
  user-select: none;
  touch-action: manipulation;
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

#stats-submenu .hotspots-menu-link:hover,
#stats-submenu .hotspots-menu-link:active,
#stats-submenu .hotspots-menu-link:focus {
  background: transparent !important;
  border-color: transparent !important;
  filter: none !important;
  outline: none !important;
  opacity: 0.75;
}

#stats-submenu .hotspots-menu-link .ms-3 {
  display: inline-block;
  margin-left: 12px;
  white-space: nowrap;
  min-width: 0;
}

#stats-submenu .hotspots-menu-link svg {
  flex: 0 0 auto;
}
