:root {
  --accent: #6c5ce7;
  --accent-soft: #a29bfe;
  --bg: #f7f6ff;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(108,92,231,.12);
  --radius-xl: 28px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: Poppins, sans-serif;
  font-weight: 300;
  color: #2d2d2d;
  /* aggiungi queste tre righe: */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content-grid {
  flex: 1; /* già presente nel file, aggiungi solo flex:1 */
}


button,
input,
select,
textarea {
  font-family: 'Poppins', sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(108,92,231,.08);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent);
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
  margin-left: auto;
}

.search-wrap .bi-search {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-soft);
  z-index: 2;
}

.search-input {
  width: 100%;
  border-radius: var(--radius-pill);
  border: 2px solid #e6e1ff;
  background: #fff;
  padding: 13px 18px 13px 46px;
  font-size: .95rem;
  font-weight: 300;
  outline: none;
  transition: .2s ease;
  box-shadow: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108,92,231,.12);
}

.search-mobile-wrap {
  display: none;
  width: 100%;
}

.autocomplete {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 2000;
  max-height: 340px;
  overflow-y: auto;
}

.ac-item {
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f2efff;
  align-items: flex-start;
}

.ac-item:last-child {
  border-bottom: 0;
}

.ac-item:hover {
  background: #f8f6ff;
}

.ac-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f3f0ff;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ac-brand {
  font-weight: 500;
  color: var(--accent);
  font-size: .88rem;
}

.ac-addr {
  font-size: .82rem;
  color: #666;
  font-weight: 300;
}

.ac-side {
  margin-left: auto;
  font-size: .78rem;
  color: #999;
  white-space: nowrap;
}

.toolbar {
  padding: 18px 24px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.switch-box,
.fuel-mobile-label,
.add-fuel-btn,
.map-btn,
.panel-card {
  background: #fff;
  border: 1px solid #ece8ff;
  box-shadow: 0 4px 14px rgba(108,92,231,.07);
}

.switch-box {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-pill);
}

.fuel-mobile-label {
  display: none;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: .84rem;
  font-weight: 500;
  align-items: center;
  gap: 8px;
}

.add-fuel-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  cursor: pointer;
  transition: .18s ease;
  position: relative;
  flex-shrink: 0;
}

.add-fuel-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.fuel-desktop-options {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fuel-desktop-options .fuel-option {
  width: auto;
  min-width: 132px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
}

.mobile-toolbar-stack {
  display: none;
  width: 100%;
}

.fuel-mobile-row {
  display: none;
}

.content-grid {
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.map-wrap {
  position: relative;
  min-width: 0;
}

#map {
  height: 72vh;
  min-height: 520px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  background: #fff;
}

.map-controls-left {
  position: absolute;
  top: 12px;
  left: 5px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-controls-right {
  position: absolute;
  top: 12px;
  right: 5px;
  z-index: 800;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.mobile-only-map-control {
  display: none;
}

.map-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.02rem;
  cursor: pointer;
  transition: .18s ease;
}

.map-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.map-top-center {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
}

.reload-map-btn {
  min-width: 220px;
  width: auto;
  padding: 10px 18px;
  height: 46px;
  border-radius: var(--radius-pill);
  font-size: .86rem;
  font-weight: 500;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.map-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 800;
  display: none;
  flex-direction: column;
  gap: 7px;
  background: rgba(255,255,255,.96);
  border: 1px solid #ece8ff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 12px;
  min-width: 170px;
}

.legend-title {
  font-size: .76rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  color: #555;
  font-weight: 300;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green {
  background: #00b894;
}

.dot-yellow {
  background: #f1b632;
}

.dot-red {
  background: #d63031;
}

.panel-card {
  border-radius: 28px;
  padding: 0;
  overflow: hidden;
}

.panel-accordion-btn {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.panel-accordion-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.panel-accordion-btn .bi-chevron-down {
  color: var(--accent);
  transition: transform .2s ease;
}

.panel-accordion-btn[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.panel-collapse-content {
  padding: 0 18px 18px;
}

.panel-subtitle {
  font-size: .8rem;
  color: #8a8a9a;
  margin-bottom: 14px;
  font-weight: 300;
}

.bestworst-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-card {
  border: 1px solid #eee9ff;
  border-radius: 22px;
  padding: 14px;
  background: #fcfbff;
}

.rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
}

.rank-good {
  background: #e8fff7;
  color: #00966f;
}

.rank-bad {
  background: #fff0f0;
  color: #bf2c2d;
}

.rank-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.rank-brand {
  font-size: .92rem;
  font-weight: 500;
  color: #3a3555;
}

.rank-addr {
  font-size: .8rem;
  color: #6f6f82;
  margin: 4px 0 10px;
  line-height: 1.4;
  font-weight: 300;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rank-chip {
  font-size: .72rem;
  font-weight: 400;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: #f3f0ff;
  color: var(--accent);
  border: 1px solid #e6e1ff;
}

.empty-state {
  border: 1px dashed #ddd6ff;
  border-radius: 22px;
  padding: 18px;
  font-size: .84rem;
  color: #86819c;
  background: #fcfbff;
  font-weight: 300;
}

.loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  z-index: 9999;
}

.loader.hidden {
  display: none;
}

.spinner-ring {
  width: 56px;
  height: 56px;
  border: 5px solid #e8e3ff;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#toastBox {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast-pill {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(108,92,231,.22);
  font-size: .86rem;
  font-weight: 400;
}

.toast-pill.error {
  background: #d63031;
}

.toast-pill.ok {
  background: #00b894;
}

.leaflet-popup-content-wrapper {
  border-radius: 20px !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.16) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
}

.popup-card {
  padding: 14px 16px;
  min-width: 240px;
}

.popup-brand {
  color: var(--accent);
  font-weight: 600;
  font-size: .98rem;
  margin-bottom: 5px;
}

.popup-addr {
  color: #777;
  font-size: .81rem;
  margin-bottom: 10px;
  font-weight: 300;
}

.popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-tag {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: .76rem;
  font-weight: 400;
  background: #f2efff;
  color: var(--accent);
  border: 1px solid #e3ddff;
}

.tag-green {
  background: #e8fff7;
  color: #00966f;
  border-color: #baf5df;
}

.tag-yellow {
  background: #fff8df;
  color: #9a6c00;
  border-color: #f4dc8d;
}

.tag-red {
  background: #fff0f0;
  color: #bf2c2d;
  border-color: #f0b0b1;
}

.popup-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.popup-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: .76rem;
  font-weight: 500;
  background: #f2efff;
  color: var(--accent);
  border: 1px solid #e3ddff;
}

.popup-action-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.popup-meta {
  margin-top: 10px;
  font-size: .73rem;
  color: #aaa;
  font-weight: 300;
}

.fuel-sheet .modal-dialog {
  margin: 0;
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  transition: none !important;
  transform: none !important;
}

.fuel-sheet .modal-content {
  border: 0;
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  min-height: 50vh;
  box-shadow: 0 -10px 40px rgba(0,0,0,.12);
  animation: none !important;
  transition: none !important;
  width: 100%;
}

.fuel-sheet.fade .modal-dialog,
.fuel-sheet.fade .modal-content,
.fuel-sheet.show .modal-dialog,
.fuel-sheet.show .modal-content {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}

.fuel-sheet-header {
  padding: 12px 18px 8px;
  text-align: center;
}

.sheet-handle {
  width: 54px;
  height: 5px;
  border-radius: 999px;
  background: #d9d3ff;
  margin: 0 auto 12px;
}

.sheet-title {
  font-size: 1rem;
  font-weight: 500;
  color: #6b6b7c;
  letter-spacing: .02em;
}

.fuel-sheet-body {
  padding: 8px 18px 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.fuel-option {
  width: 100%;
  border: 1px solid #ece8ff;
  border-radius: 20px;
  background: #fcfbff;
  color: #443f60;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  font-weight: 400;
  transition: .18s ease;
}

.fuel-option.active,
.fuel-option:hover {
  background: #f3f0ff;
  border-color: #dcd3ff;
  color: var(--accent);
}

.fuel-option-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fuel-option i {
  font-size: 1rem;
}

.price-pin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-2px);
}

.price-pin-label {
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  border: 1px solid #ece8ff;
  box-shadow: 0 4px 14px rgba(108,92,231,.10);
  font-size: .7rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
}

.map-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #fff;
  border-radius: 0;
}

.map-wrap.is-fullscreen #map {
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

@media (max-width: 1200px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .add-fuel-btn,
  .fuel-mobile-label,
  .mobile-toolbar-stack,
  .search-mobile-wrap,
  .fuel-mobile-row {
    display: none !important;
  }

  #bestWorstCollapse {
    display: block !important;
    height: auto !important;
  }

  .panel-accordion-btn {
    pointer-events: none;
  }

  .panel-accordion-btn .bi-chevron-down {
    display: none;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 14px 16px;
  }

  .topbar .search-wrap.desktop-search {
    display: none;
  }

  .toolbar {
    padding: 10px 14px 14px;
    justify-content: space-between;
    align-items: stretch;
  }

  .toolbar-left {
    width: 100%;
    justify-content: space-between;
    flex-direction: column;
    gap: 10px;
  }

  .switch-box {
    display: none;
  }

  .fuel-desktop-options {
    display: none !important;
  }

  .mobile-toolbar-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .search-mobile-wrap {
    display: block;
    margin-bottom: 0;
    width: 100%;
  }

  .search-mobile-wrap .search-wrap {
    max-width: 100%;
    margin-left: 0;
  }

  .fuel-mobile-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .fuel-mobile-label {
    display: inline-flex;
    flex: 1;
    width: auto;
    justify-content: flex-start;
  }

  .add-fuel-btn {
    align-self: auto;
    flex-shrink: 0;
  }

  .content-grid {
    padding: 0 14px 18px;
    gap: 14px;
  }

  #map {
    height: 63vh;
    min-height: 420px;
    border-radius: 24px;
  }

  .map-controls-left {
    top: 10px;
    left: 5px;
  }

  .map-controls-right {
    top: 10px;
    right: 5px;
  }

  .mobile-only-map-control {
    display: flex;
  }

  .map-top-center {
    top: 10px;
    width: calc(100% - 120px);
  }

  .reload-map-btn {
    width: 100%;
    min-width: 0;
    height: 44px;
    font-size: .82rem;
  }

  .map-legend {
    display: flex;
    right: 10px;
    left: 10px;
    bottom: 10px;
    min-width: 0;
    width: auto;
    border-radius: 18px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
  }

  .legend-title {
    display: none;
  }

  .legend-row {
    flex: 1;
    justify-content: center;
    text-align: center;
    gap: 6px;
    font-size: .68rem;
  }

  .panel-card {
    border-radius: 24px;
  }

  .panel-accordion-btn {
    padding: 16px;
    pointer-events: auto;
  }

  .panel-accordion-btn .bi-chevron-down {
    display: inline-block;
  }

  .panel-collapse-content {
    padding: 0 16px 16px;
  }
}

/* ── Footer ── */
.benzamap-footer {
  background: #fff;
  border-top: 1px solid rgba(108, 92, 231, .10);
  padding: 14px 24px;
  margin-top: auto;
  z-index: 100;
  position: relative;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-copy {
  font-size: .78rem;
  color: #8a8a9a;
  font-weight: 300;
}
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-link {
  font-size: .78rem;
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 400;
  transition: color .18s ease;
}
.footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
@media (max-width: 480px) {
  .benzamap-footer {
    padding: 12px 14px;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
