/* ===================================================================
   Vitanuova Uffici Map — v1.2.0
   Font: Plus Jakarta Sans (Google Fonts)
   Palette: Navy #12284C · Blue #1A56DB · White · Gray #F4F6F9
=================================================================== */

/* --- Reset scoped ------------------------------------------------- */
.vnmap-widget *,
.vnmap-widget *::before,
.vnmap-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.vnmap-widget {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: #1a1f36;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(18,40,76,.14), 0 2px 8px rgba(18,40,76,.08);
  background: #fff;
  width: 100%;
}

/* --- Header ------------------------------------------------------- */
.vnmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #12284C;
  position: relative;
}

.vnmap-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #1A56DB 0%, #3B82F6 50%, transparent 100%);
}

.vnmap-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.vnmap-logo-icon {
  width: 28px;
  height: 28px;
  color: #60A5FA;
  flex-shrink: 0;
}

.vnmap-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Region select ------------------------------------------------ */
.vnmap-header-right { flex-shrink: 0; }

.vnmap-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.vnmap-select-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: #93C5FD;
  pointer-events: none;
}

.vnmap-region-select {
  appearance: none;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 36px 8px 34px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  outline: none;
}

.vnmap-region-select option { color: #1a1f36; background: #fff; }

.vnmap-region-select:focus,
.vnmap-region-select:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.4);
}

.vnmap-chevron-select {
  position: absolute;
  right: 10px;
  width: 14px;
  height: 14px;
  color: #93C5FD;
  pointer-events: none;
}

/* --- Body layout -------------------------------------------------- */
.vnmap-body {
  display: flex;
  overflow: hidden;
}

/* --- Sidebar ------------------------------------------------------ */
.vnmap-sidebar {
  width: 38%;
  min-width: 260px;
  flex-shrink: 0;
  border-right: 1px solid #E8ECF2;
  background: #FAFBFD;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vnmap-sidebar-inner {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.vnmap-sidebar-inner::-webkit-scrollbar { width: 4px; }
.vnmap-sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.vnmap-sidebar-inner::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

/* --- Region group ------------------------------------------------- */
.vnmap-region-group { margin-bottom: 4px; }

.vnmap-region-group[data-hidden="true"] { display: none; }

.vnmap-region-label {
  font-size: 10px;
  font-weight: 700;
  color: #8A94A6;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 20px 4px;
}

/* --- Office item (accordion) -------------------------------------- */
.vnmap-office-item {
  margin: 0;
  border-bottom: 1px solid #EEF0F5;
  transition: background .15s;
}

.vnmap-office-item:last-child { border-bottom: none; }

.vnmap-office-item.vnmap-active {
  background: #fff;
  box-shadow: inset 3px 0 0 #1A56DB;
}

.vnmap-office-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}

.vnmap-office-header:hover { background: rgba(26,86,219,.04); }

.vnmap-office-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Pillola tipo ufficio */
.vnmap-tipo-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  border-radius: 20px;
  border: 1.5px solid currentColor;
  padding: 2px 8px 2px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
  transition: background .15s;
}

.vnmap-tipo-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Colori dinamici via CSS var --pill-color iniettata inline dal PHP */
.vnmap-tipo-pill {
  color:        var(--pill-color, #6B7A99);
  border-color: var(--pill-color, #6B7A99);
}
.vnmap-tipo-pill .vnmap-tipo-pill-dot {
  background: var(--pill-color, #6B7A99);
}
/* Item attivo: pillola piena */
.vnmap-active .vnmap-tipo-pill {
  background:   var(--pill-color, #6B7A99);
  border-color: var(--pill-color, #6B7A99);
  color: #fff;
}
.vnmap-active .vnmap-tipo-pill .vnmap-tipo-pill-dot {
  background: #fff;
}

.vnmap-office-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1f36;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vnmap-active .vnmap-office-name { color: #1A56DB; }

/* Chevron animato */
.vnmap-chevron {
  width: 16px;
  height: 16px;
  color: #8A94A6;
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1), color .15s;
}

.vnmap-active .vnmap-chevron {
  transform: rotate(180deg);
  color: #1A56DB;
}

/* --- Office detail (accordion content) ---------------------------- */
.vnmap-office-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.4,0,.2,1), opacity .25s;
  opacity: 0;
  padding: 0 20px;
}

.vnmap-active .vnmap-office-detail {
  max-height: 240px;
  opacity: 1;
  padding: 0 20px 14px;
}

.vnmap-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 0;
  font-size: 13px;
  color: #3D4966;
  line-height: 1.45;
}

.vnmap-detail-row:first-child { padding-top: 0; }

.vnmap-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #6B7A99;
  margin-top: 1px;
}

.vnmap-detail-row a {
  color: #1A56DB;
  text-decoration: none;
}
.vnmap-detail-row a:hover { text-decoration: underline; }

.vnmap-directions-row { margin-top: 4px; }
.vnmap-directions-row a {
  font-weight: 600;
  font-size: 12px;
  color: #1A56DB !important;
}

/* --- Map panel ---------------------------------------------------- */
.vnmap-map-panel {
  flex: 1;
  position: relative;
  background: #E8ECF2;
}

.vnmap-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .4s;
}

.vnmap-map.vnmap-map-ready { opacity: 1; }

.vnmap-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity .3s;
}

.vnmap-map-placeholder svg {
  width: 64px;
  height: 64px;
  opacity: .5;
}

.vnmap-map-placeholder p {
  font-size: 13px;
  color: #8A94A6;
  font-weight: 500;
}

.vnmap-map-ready ~ .vnmap-map-placeholder,
.vnmap-map-panel.vnmap-has-map .vnmap-map-placeholder {
  opacity: 0;
}

/* --- Empty state -------------------------------------------------- */
.vnmap-no-results {
  padding: 32px 20px;
  text-align: center;
  color: #8A94A6;
  font-size: 13px;
  display: none;
}

.vnmap-no-results.vnmap-visible { display: block; }

/* --- Leaflet popup overrides -------------------------------------- */
.vnmap-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 24px rgba(18,40,76,.18) !important;
}
.vnmap-leaflet-popup .leaflet-popup-content { margin: 0 !important; }

/* --- Google InfoWindow overrides ---------------------------------- */
.gm-style .gm-style-iw-c {
  padding: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 24px rgba(18,40,76,.18) !important;
}
.gm-style .gm-style-iw-d { overflow: hidden !important; padding: 0 !important; }

/* --- Popup condiviso Google + Leaflet ----------------------------- */
.vnmap-popup {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  min-width: 220px;
  max-width: 280px;
  font-size: 13px;
}
.vnmap-popup-header {
  padding: 10px 14px 8px;
  color: #fff;
  line-height: 1.3;
}
.vnmap-popup-tipo {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .8;
  display: block;
  margin-bottom: 2px;
}
.vnmap-popup-nome {
  font-size: 15px;
  font-weight: 700;
  display: block;
}
.vnmap-popup-body { padding: 10px 14px 12px; background: #fff; }
.vnmap-popup-body p { margin: 0 0 5px; color: #3D4966; line-height: 1.45; }
.vnmap-popup-body a { color: #1A56DB; text-decoration: none; font-size: 12px; font-weight: 600; }
.vnmap-popup-body a:hover { text-decoration: underline; }

/* --- Responsive (mobile) ------------------------------------------ */
@media (max-width: 700px) {
  .vnmap-body { flex-direction: column; height: auto !important; }
  .vnmap-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #E8ECF2; max-height: 320px; }
  .vnmap-map-panel { height: 300px; position: relative; flex: none; }
  .vnmap-map { position: absolute; }
  .vnmap-title { font-size: 14px; }
  .vnmap-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* --- Ricerca città ------------------------------------------------- */
.vnmap-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vnmap-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.vnmap-search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: #93C5FD;
  pointer-events: none;
  flex-shrink: 0;
}

.vnmap-city-search {
  appearance: none;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 30px 8px 32px;
  width: 180px;
  transition: width .25s ease, background .2s, border-color .2s;
  outline: none;
}

.vnmap-city-search::placeholder { color: rgba(255,255,255,.5); }

.vnmap-city-search:focus {
  width: 220px;
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.45);
}

/* WebKit: rimuovi icona search nativa */
.vnmap-city-search::-webkit-search-decoration,
.vnmap-city-search::-webkit-search-cancel-button { display: none; }

/* Pulsante ✕ clear */
.vnmap-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.6);
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transition: color .15s;
}

.vnmap-search-clear svg {
  width: 12px;
  height: 12px;
}

.vnmap-search-clear:hover { color: #fff; }

.vnmap-search-clear-visible { display: flex; }

/* --- No results ---------------------------------------------------- */
.vnmap-no-results {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  color: #8A94A6;
  flex: 1;
}

.vnmap-no-results.vnmap-visible { display: flex; }

.vnmap-no-results p {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}

/* --- Responsive ----------------------------------------------------- */
@media (max-width: 700px) {
  .vnmap-header-right { flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
  .vnmap-city-search  { width: 100%; }
  .vnmap-city-search:focus { width: 100%; }
  .vnmap-select-wrap  { width: 100%; }
  .vnmap-region-select { width: 100%; }
}

/* ===================================================================
   Cluster icon — v1.7.0
=================================================================== */

/* Leaflet cluster */
.vnmap-cluster-icon {
  background: #12284C;
  border-radius: 50%;
  color: #fff;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: 0 2px 8px rgba(18,40,76,.35);
  transition: transform .15s ease;
}

.vnmap-cluster-icon:hover {
  transform: scale(1.08);
}

/* Override stili default Leaflet.markercluster (li azzeriamo, usiamo il nostro) */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform .3s ease-out, opacity .3s ease-in;
}
