/* ══════════════════════════════════════════════════
   FZ PC SIDEBAR — V7 style
   Adapted from mockup-sidebar-nav.html (V7 section)
   ID/class renames:
     #sb-v7          → #fz-pc-sidebar
     .v7-tab         → #fz-pc-sidebar-tab
     .v7-user-btn    → #fz-pc-user-btn
   body.ver-7 prefixes removed (always active)
   All .v7-* child class names kept as-is.
══════════════════════════════════════════════════ */

/* Bouton user flottant haut-droite */
#fz-pc-user-btn {
  position: fixed; top: 12px; right: 160px;
  z-index: 9001;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(11,22,30,0.92);
  border: 1.5px solid rgba(79,195,247,0.35);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
#fz-pc-user-btn:hover { border-color: #4fc3f7; box-shadow: 0 0 12px rgba(79,195,247,0.3); }
#fz-pc-user-btn svg { width: 18px; height: 18px; }
.v7-user-badge {
  position: absolute; top: -3px; right: -3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #ef4444; border: 2px solid rgba(11,22,30,0.95);
  color: #fff; font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Tab de réouverture (quand sidebar cachée) */
#fz-pc-sidebar-tab {
  position: fixed; top: 50%; left: 0; transform: translateY(-50%);
  width: 28px; height: 90px; z-index: 1002;
  background: #0c1520;
  border: 1px solid rgba(37, 146, 197, 0.71);
  border-left: none;
  border-radius: 0 10px 10px 0;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 3px 0 12px rgba(0,0,0,0.5);
  transition: background .15s;
}
#fz-pc-sidebar-tab:hover { background: rgba(79,195,247,0.1); }
#fz-pc-sidebar-tab svg { width: 17px; height: 17px; color: rgba(124, 174, 197, 0.781); }

/* Désactive toutes les transitions pendant la restauration de l'état initial */
#fz-pc-sidebar.no-anim,
#fz-pc-sidebar.no-anim * {
  transition: none !important;
  animation: none !important;
}

/* Sidebar */
#fz-pc-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 54px; z-index: 1000;
  display: flex; flex-direction: column;
  background: rgba(12,30,43,0.97);
  border-right: 1px solid rgba(79,195,247,0.15);
  box-shadow: 2px 0 20px rgba(0,0,0,0.5);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: width .28s cubic-bezier(.4,0,.2,1), transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#fz-pc-sidebar.open    { width: 228px; }
#fz-pc-sidebar.hidden  { transform: translateX(-100%); }

/* Header */
.v7-head {
  display: flex; align-items: center;
  flex-shrink: 0; height: 54px; padding: 0 9px 0 10px;
  border-bottom: 1px solid rgba(79,195,247,0.09);
  gap: 6px;
}
.v7-logo {
  display: flex; align-items: center; gap: 10px;
  flex: 1; overflow: hidden; min-width: 0;
  text-decoration: none;
}
.v7-logo-ic {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px;
  background: rgba(79,195,247,0.12);
  display: flex; align-items: center; justify-content: center;
}
  .v7-logo-ic svg,
  .v7-logo-ic img { width: 20px; height: 20px; display: block; }
  .v7-logo-text {
    font-size: 13px; font-weight: 700; color: #dff3ff;
    white-space: nowrap; letter-spacing: .02em;
    display: none;
    opacity: 0; transform: translateX(-6px);
    transition: opacity .2s, transform .2s;
  }
#fz-pc-sidebar.open .v7-logo-text { opacity: 1; transform: translateX(0); }

/* Les 2 boutons header (chevron + close) */
.v7-hbtns {
  display: flex; gap: 4px; flex-shrink: 0;
  opacity: 0; transition: opacity .2s;
}
#fz-pc-sidebar.open .v7-hbtns { opacity: 1; }

.v7-hbtn {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  border: none; cursor: pointer;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: background .14s, color .14s;
}
.v7-hbtn:hover { background: rgba(79,195,247,0.12); color: #4fc3f7; }
.v7-hbtn svg { width: 13px; height: 13px; }

/* Chevron : tourne quand expanded (toujours montré même collapsed) */
.v7-chevron { opacity: 1 !important; }
#fz-pc-sidebar:not(.open) .v7-hbtns { opacity: 1; } /* toujours visible pour pouvoir déplier */
#fz-pc-sidebar:not(.open) .v7-hbtn-close { display: none; }
.v7-hbtn-chevron svg { transition: transform .28s; transform: scaleX(-1); }
#fz-pc-sidebar.open .v7-hbtn-chevron svg { transform: scaleX(1); }

/* Scroll */
.v7-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding: 8px 0; }
.v7-scroll::-webkit-scrollbar { display: none; }

/* Section label — style dot, sans toggle accordion */
.v7-sec {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 4px 13px;
  white-space: nowrap; overflow: hidden;
  opacity: 0; max-height: 0;
  transition: opacity .18s, max-height .18s, padding .18s;
}
#fz-pc-sidebar.open .v7-sec { opacity: 1; max-height: 30px; }

.v7-sec-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  transition: box-shadow .2s;
}
#fz-pc-sidebar.open .v7-sec-dot { box-shadow: 0 0 6px currentColor; }
.v7-sec-text {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: rgba(255,255,255,0.28);
}
/* Couleurs dots par section */
.v7-sec.nav  .v7-sec-dot { background: #4fc3f7; color: #4fc3f7; }
.v7-sec.disc .v7-sec-dot { background: #4ade80; color: #4ade80; }
.v7-sec.tool .v7-sec-dot { background: #fbbf24; color: #fbbf24; }
.v7-sec.com  .v7-sec-dot { background: #f472b6; color: #f472b6; }

/* Séparateur */
.v7-sep { height: 1px; background: rgba(79,195,247,0.08); margin: 3px 8px; }

/* Item — hover avec indent (style V5) */
.v7-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0 11px; height: 40px; margin: 1px 5px;
  border-radius: 9px; cursor: pointer;
  border: none; background: none; width: calc(100% - 10px);
  white-space: nowrap; overflow: hidden; text-decoration: none;
  text-align: left;
  color: rgba(255,255,255,0.5);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 13px; font-weight: 400;
  transition: background .15s, color .15s, padding-left .15s;
  position: relative;
}
/* Hover : indent + bg — seulement en mode expanded */
#fz-pc-sidebar.open .v7-item:hover {
  background: rgba(79,195,247,0.07);
  color: rgba(255,255,255,0.85);
  padding-left: 15px; /* indent subtil depuis 11px */
}
.v7-item.active {
  background: rgba(79,195,247,0.13);
  color: #dff3ff; font-weight: 500;
}
.v7-item.active::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: #4fc3f7;
}
#fz-pc-sidebar.open .v7-item.active:hover { padding-left: 11px; } /* pas d'indent si actif */

.v7-ic {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  transition: background .15s, filter .15s;
  position: relative;
}
.v7-ic svg { width: 20px; height: 20px; }
.v7-item.active .v7-ic {
  background: rgba(79,195,247,0.18);
  filter: drop-shadow(0 0 5px rgba(79,195,247,0.35));
}
.v7-item.active .v7-ic img,
.v7-item:hover .v7-ic img { opacity: 1 !important; }

.v7-label {
  opacity: 0; transform: translateX(-6px); flex: 1;
  overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, transform .2s;
}
#fz-pc-sidebar.open .v7-label { opacity: 1; transform: translateX(0); }

.v7-badge {
  flex-shrink: 0; font-size: 10px; font-weight: 600;
  background: rgba(79,195,247,0.18); color: #4fc3f7;
  padding: 1px 6px; border-radius: 10px;
  border: 1px solid rgba(79,195,247,0.2);
  opacity: 0; transition: opacity .2s;
}
#fz-pc-sidebar.open .v7-badge { opacity: 1; }

/* Ligne user + déconnexion */
.v7-user-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 5px;
}
.v7-user-row .v7-item {
  margin: 0;
  width: 100%;
}
#fz-pc-sidebar.open .v7-user-row {
  flex-direction: row;
  align-items: center;
}
#fz-pc-sidebar.open .v7-user-row .v7-user-item { flex: 1 1 auto; }
#fz-pc-sidebar.open .v7-user-row .v7-logout-item {
  flex: 0 0 40px;
  width: 40px;
  padding: 0;
  justify-content: center;
  order: -1;
}
#fz-pc-sidebar.open .v7-user-row .v7-logout-item:hover {
  padding-left: 0;
}
#fz-pc-sidebar.open .v7-logout-item .v7-ic svg {
  transform: rotate(180deg);
}
#fz-pc-sidebar:not(.open) .v7-logout-item .v7-ic svg {
  transform: rotate(180deg);
}
#fz-pc-sidebar:not(.open) .v7-user-row .v7-logout-item {
  order: -1;
}
.v7-logout-item .v7-ic svg {
  width: 16px;
  height: 16px;
}
.v7-logout-item {
  color: rgba(159,230,255,0.65);
}
#fz-pc-sidebar.open .v7-logout-item:hover {
  color: #4fc3f7;
}

/* Légal */
.v7-legal {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px 6px; padding: 6px 13px 8px;
  opacity: 0; max-height: 0; overflow: hidden;
  transition: opacity .18s, max-height .18s;
}
#fz-pc-sidebar.open .v7-legal { opacity: 1; max-height: 60px; }

.v7-legal-link {
  font-size: 10px; color: rgba(255,255,255,0.2);
  text-decoration: none; white-space: nowrap;
  transition: color .14s;
}
.v7-legal-link:hover { color: rgba(79,195,247,0.6); }

.v7-legal-dot { font-size: 10px; color: rgba(255,255,255,0.1); }

/* Footer */
.v7-footer {
  flex-shrink: 0; padding: 4px 0 8px;
  border-top: 1px solid rgba(79,195,247,0.08);
}

/* Tooltip JS (bulle au survol, rendu hors sidebar pour éviter overflow:hidden) */
.fz-sb-tip {
  position: fixed; z-index: 99999;
  padding: 5px 11px; border-radius: 8px;
  background: rgba(9,18,26,0.97); color: #dff3ff;
  border: 1px solid rgba(79,195,247,0.22);
  box-shadow: 3px 3px 14px rgba(0,0,0,0.5);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px; font-weight: 500;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .14s;
  transform: translateY(-50%);
}
.fz-sb-tip.show { opacity: 1; }

/* Masquer boutons retour carte sur PC (sidebar remplace la navigation) */
@media (min-width: 769px) {
  .fp-back-map { display: none !important; }
}

/* Sidebar s'adapte à la timeline (index.php seulement) */
body.fz-has-timeline #fz-pc-sidebar { bottom: 92px; }
body.fz-has-timeline.timeline-collapsed #fz-pc-sidebar { bottom: 34px; }

/* Vues dédiées PC : la sidebar doit aller jusqu'en bas */
@media (min-width: 769px) {
  body.dedicated-view #fz-pc-sidebar {
    bottom: 0 !important;
  }
}

/* Rangée inline : fond de carte + langue */
.v7-inline-row {
  display: flex;
  gap: 6px;
  margin: 1px 5px;
}
.v7-inline-row .v7-item {
  margin: 0;
  width: auto;
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 9px;
}
.v7-inline-row .v7-basemap-item { flex: 1 1 auto; }
.v7-inline-row .v7-lang-item { flex: 0 0 auto; }
#fz-pc-sidebar.open .v7-inline-row .v7-item:hover {
  padding-left: 9px !important;
  background: none !important;
  color: inherit !important;
}
.v7-inline-item { cursor: default !important; }

/* Select fond de carte / langue dans la sidebar */
.v7-basemap-item { cursor: default !important; }
.v7-basemap-item:hover { padding-left: 11px !important; background: none !important; color: inherit !important; }
.v7-basemap-select,
.v7-lang-select {
  width: 100%;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateX(-6px);
  transition: opacity .2s, transform .2s;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(79,195,247,0.18);
  border-radius: 6px;
  color: rgba(255,255,255,0.75);
  font-size: 12px; padding: 3px 6px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.v7-lang-select {
  width: max-content;
  min-width: 48px;
}
#fz-pc-sidebar.open .v7-basemap-select,
#fz-pc-sidebar.open .v7-lang-select { opacity: 1; transform: translateX(0); }
.v7-basemap-select:focus,
.v7-lang-select:focus { border-color: rgba(79,195,247,0.5); }
.v7-basemap-select option,
.v7-lang-select option { background: #0c1e2b; color: #dff3ff; }

/* Hide on mobile */
@media (max-width: 768px) {
  #fz-pc-sidebar,
  #fz-pc-sidebar-tab,
  #fz-pc-user-btn {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════
   RPC — Carte flottante droite (filtres + contribuer)
══════════════════════════════════════════════════ */
  #rp-c {
    position: fixed;
    top: 120px;
    right: 10px;
    z-index: 820;
    background: rgba(18, 32, 44, 0.68);
    border: 2px solid rgba(79, 195, 247, 0.18);
    border-radius: 33px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    padding: 8px 4px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    display: none;
  }
@media (min-width: 769px) {
  #rp-c { display: flex; }
  .map-view-shortcuts { display: none !important; }
}
@media (max-width: 768px) {
  #rp-c { display: none !important; }
}
.rp-c-btn {
  width: 40px; height: 40px; border-radius: 20px; margin: 0 2px;
  background: transparent; border: none;
  color: rgba(255,255,255,0.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .14s, color .14s;
}
.rp-c-btn:hover { background: rgba(79,195,247,0.1); color: #4fc3f7; transform: translateY(-1px) scale(1.04); filter: brightness(1.06);}
.rp-c-btn.active { background: rgba(79,195,247,0.14); color: #4fc3f7; }
.rp-c-btn svg { width: 18px; height: 18px; }
.rp-c-sep { width: 22px; height: 1px; background: rgba(255,255,255,0.08); margin: 4px auto; }
  .rp-c-contribute {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 1px 4px;
    background: linear-gradient(135deg, #ffcf3f 0%, #ff9f1a 100%);
    border: 2px solid rgba(255, 241, 199, 0.95);
    color: #14202b;
    cursor: pointer;
    font-family: inherit;
    display: grid;
    place-items: center;
    padding: 0;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(15, 22, 30, 0.35), 0 0 0 0 rgba(255, 179, 0, 0.55);
    transition: transform .18s ease, filter .2s ease, box-shadow .25s ease;
    animation: rpc-pulse 5s ease-in-out infinite;
  }

.rp-c-contribute:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.06);
  box-shadow: 0 8px 20px rgba(15,22,30,0.4), 0 0 0 8px rgba(255,179,0,0.16);
}
@keyframes rpc-pulse {
  0%,100% { box-shadow: 0 8px 20px rgba(15,22,30,0.35), 0 0 0 0 rgba(255,179,0,0.45); }
  50%     { box-shadow: 0 8px 20px rgba(15,22,30,0.38), 0 0 0 8px rgba(255,179,0,0.1); }
}

/* ══════════════════════════════════════════════════
   BOUTON PWA PC — style maquette
══════════════════════════════════════════════════ */
@media (min-width: 769px) {
  #pwa-install-btn.pwa-install-icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    flex: 0 0 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    background: rgba(11,22,30,0.92) !important;
    border: 1.5px solid rgba(79,195,247,0.35) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4) !important;
    transition: border-color .15s, box-shadow .15s !important;
    color: rgba(79,195,247,0.7) !important;
  }
  #pwa-install-btn.pwa-install-icon-btn:hover {
    background: rgba(11,22,30,0.92) !important;
    border-color: #4fc3f7 !important;
    box-shadow: 0 0 12px rgba(79,195,247,0.3) !important;
    color: #4fc3f7 !important;
  }
  #pwa-install-btn.pwa-install-icon-btn svg {
    width: 16px !important;
    height: 16px !important;
  }
}

/* ══════════════════════════════════════════════════
   BOUTON USER PC — style maquette
   Sur desktop, login/dashboard btn devient circulaire
══════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* Style appliqué quand le bouton est visible (JS contrôle display via style inline) */
  #user-login-btn,
  #user-dashboard-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    flex: 0 0 36px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    background: rgba(11,22,30,0.92) !important;
    border: 1.5px solid rgba(79,195,247,0.35) !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4) !important;
    transition: border-color .15s, box-shadow .15s !important;
    position: relative;
    /* display géré par JS — pas de !important ici */
  }
  /* Quand affiché par JS (display:block ou flex), forcer inline-flex pour aligner l'icône */
  #user-login-btn:not([style*="display: none"]),
  #user-dashboard-btn:not([style*="display: none"]) {
    display: inline-flex !important;
  }
  #user-login-btn:hover,
  #user-dashboard-btn:hover {
    background: rgba(11,22,30,0.92) !important;
    border-color: #4fc3f7 !important;
    box-shadow: 0 0 12px rgba(79,195,247,0.3) !important;
  }
  #user-login-btn svg,
  #user-dashboard-btn svg {
    width: 18px !important;
    height: 18px !important;
  }
  /* Badge notifications */
  .user-dashboard-notif-badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 15px; height: 15px; border-radius: 50%;
    background: #ef4444; border: 2px solid rgba(11,22,30,0.95);
    color: #fff; font-size: 8px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .user-dashboard-notif-badge[hidden] {
    display: none !important;
  }
}
