/* =========================================================
   E85 / Ethanol Station Map
   Visual language matches /ethanol (Ethanol Calculator):
   same .calc-card aesthetic, brand blue (#0563bb), soft
   shadows, Open Sans / Raleway typography.
   ========================================================= */

#hero .hero-actions {
  margin-top: 28px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 26px;
  background: #0563bb;
  color: #ffffff;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(5, 99, 187, 0.28);
  transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.hero-cta:hover,
.hero-cta:focus {
  background: #0466c8;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(5, 99, 187, 0.35);
  text-decoration: none;
}

.hero-cta i {
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 575.98px) {
  .hero-cta {
    padding: 11px 22px;
    font-size: 14px;
  }
}

.ethanol-map {
  padding: 60px 0;
}

.ethanol-map .section-title .map-subtitle {
  max-width: 720px;
  margin: 12px auto 0;
  color: #6c757d;
  font-size: 14.5px;
  line-height: 1.6;
}

.ethanol-map .section-title .map-subtitle a {
  color: #0563bb;
  font-weight: 600;
  text-decoration: none;
}

.ethanol-map .section-title .map-subtitle a:hover {
  text-decoration: underline;
}

/* ---------- Card wrapper (mirrors .calc-card) ---------- */
.map-card {
  background: #fff;
  box-shadow: 0px 5px 90px 0px rgba(110, 123, 131, 0.1);
  padding: 30px 30px 36px;
  border-radius: 8px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- Controls bar ---------- */
.map-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.map-search {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.map-search-wrap {
  position: relative;
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.map-search-wrap:focus-within {
  border-color: #0563bb;
  box-shadow: 0 0 0 3px rgba(5, 99, 187, 0.12);
}

.map-search-wrap i.bx {
  font-size: 18px;
  color: #6c757d;
  padding: 0 12px;
}

.map-search-wrap input {
  flex: 1;
  border: none;
  outline: none;
  padding: 11px 12px 11px 0;
  font-size: 15px;
  font-family: "Open Sans", sans-serif;
  color: #45505b;
  background: transparent;
}

.map-search-wrap input::placeholder {
  color: #adb5bd;
  font-size: 14px;
}

/* Re-use site-wide .search-button style; add sizing tweaks */
.map-search .search-button {
  margin: 0;
  padding: 10px 28px;
  font-size: 14px;
  font-family: "Open Sans", sans-serif;
}

.locate-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e8f0fb;
  color: #0563bb;
  border: 1px solid #c8dcf2;
  border-radius: 50px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.locate-button:hover {
  background: #0563bb;
  color: #fff;
  border-color: #0563bb;
}

.locate-button i.bx {
  font-size: 16px;
}

.locate-button:disabled {
  opacity: 0.75;
  cursor: progress;
}

.locate-button .locate-spinner { display: none; }
.locate-button.is-locating .locate-icon { display: none; }
.locate-button.is-locating .locate-spinner {
  display: inline-block;
  animation: ethSpin 0.8s linear infinite;
}

.locate-button .locate-label-short { display: none; }

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

/* ---------- Filter row ---------- */
.map-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  padding: 14px 16px;
  background: #f8fafd;
  border: 1px solid #e4eaf1;
  border-radius: 8px;
}

.map-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-filter label {
  font-size: 13px;
  font-weight: 600;
  color: #45505b;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.map-filter select {
  padding: 7px 30px 7px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: "Open Sans", sans-serif;
  color: #45505b;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%236c757d' d='M0 0l5 6 5-6z'/></svg>")
    no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.map-filter select:focus {
  border-color: #0563bb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 99, 187, 0.12);
}

.map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #45505b;
  cursor: pointer;
  margin: 0;
  user-select: none;
}

.map-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0563bb;
  cursor: pointer;
}

/* ---------- Status / error pill ---------- */
.map-status {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  margin-bottom: 18px;
  line-height: 1.5;
}

.map-status[hidden] { display: none; }

.map-status.error {
  color: #b3261e;
  background: #fdecea;
  border-left-color: #d93025;
}

.map-status.info {
  color: #173b6c;
  background: #eaf3fc;
  border-left-color: #0563bb;
}

.map-status.success {
  color: #0b7a3d;
  background: #e6f7ed;
  border-left-color: #16a34a;
}

/* ---------- Map / list two-column layout ---------- */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 22px;
}

.map-pane {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e4eaf1;
  background: #f8fafd;
  display: flex;
  flex-direction: column;
}

.map-canvas {
  width: 100%;
  height: 540px;
  background: #eef2f6;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  font-size: 14px;
  color: #173b6c;
  font-weight: 600;
  z-index: 500;
}

.map-loading.is-active {
  display: flex;
}

.map-loading .spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #c8dcf2;
  border-top-color: #0563bb;
  border-radius: 50%;
  animation: ethSpin 0.8s linear infinite;
}

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

.map-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border-top: 1px solid #e4eaf1;
  font-size: 12.5px;
  color: #6c757d;
  font-family: "Open Sans", sans-serif;
}

.result-count {
  color: #45505b;
  font-weight: 700;
}

.result-updated {
  font-style: italic;
}

/* ---------- Sidebar list ---------- */
.map-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-list-title {
  font-size: 15px;
  font-weight: 700;
  color: #45505b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
  font-family: "Raleway", sans-serif;
}

.station-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}

.station-list::-webkit-scrollbar {
  width: 6px;
}
.station-list::-webkit-scrollbar-track {
  background: #f1f4f8;
  border-radius: 3px;
}
.station-list::-webkit-scrollbar-thumb {
  background: #cdd7e4;
  border-radius: 3px;
}
.station-list::-webkit-scrollbar-thumb:hover {
  background: #0563bb;
}

.station-card {
  background: #fff;
  border: 1px solid #e4eaf1;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  font-family: "Open Sans", sans-serif;
}

.station-card:hover,
.station-card.is-active {
  border-color: #0563bb;
  box-shadow: 0 4px 14px rgba(5, 99, 187, 0.12);
  transform: translateY(-1px);
}

.station-card .station-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.station-card .station-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #45505b;
  line-height: 1.3;
}

.station-card .station-distance {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #0563bb;
  background: #e8f0fb;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}

.station-card .station-address {
  font-size: 12.5px;
  color: #6c757d;
  line-height: 1.45;
  margin-bottom: 8px;
}

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

.station-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #0b7a3d;
  background: #e6f7ed;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.station-tag.tag-private {
  color: #92400e;
  background: #fef3c7;
}

.station-tag.tag-fuel {
  color: #173b6c;
  background: #eaf3fc;
}

.station-tag.tag-custom {
  color: #92400e;
  background: #fff4e0;
}

/* ---------- Empty / skeleton ---------- */
.station-empty {
  padding: 22px 16px;
  text-align: center;
  color: #6c757d;
  font-size: 13.5px;
  font-family: "Open Sans", sans-serif;
  background: #f8fafd;
  border: 1px dashed #cdd7e4;
  border-radius: 10px;
  list-style: none;
  line-height: 1.55;
}

.station-skeleton {
  background: #fff;
  border: 1px solid #e4eaf1;
  border-radius: 10px;
  padding: 14px 16px;
  list-style: none;
}

.station-skeleton .sk-line {
  height: 12px;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafd 50%, #eef2f6 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.4s infinite;
  border-radius: 6px;
  margin-bottom: 8px;
}

.station-skeleton .sk-line.short { width: 50%; }
.station-skeleton .sk-line.med   { width: 80%; }

@keyframes skShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Leaflet popup brand styling ---------- */
.leaflet-container {
  font-family: "Open Sans", sans-serif !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  padding: 4px !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-size: 13px !important;
  color: #45505b !important;
  line-height: 1.5 !important;
  min-width: 220px;
}

.leaflet-popup-content .pop-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #173b6c;
  margin-bottom: 4px;
  font-family: "Raleway", sans-serif;
}

.leaflet-popup-content .pop-addr {
  color: #6c757d;
  margin-bottom: 8px;
}

.leaflet-popup-content .pop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.leaflet-popup-content .pop-link {
  display: inline-block;
  margin-top: 4px;
  color: #0563bb;
  font-weight: 600;
  font-size: 12.5px;
  text-decoration: none;
}

.leaflet-popup-content .pop-link:hover {
  text-decoration: underline;
}

/* Custom map markers (E85 = brand blue, generic = grey) */
.eth-marker {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: #0563bb;
  border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.eth-marker::after {
  content: "";
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: rotate(45deg);
}

.eth-marker.you {
  background: #16a34a;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.25), 0 3px 8px rgba(0, 0, 0, 0.25);
  transform: none;
}
.eth-marker.you::after { display: none; }

/* Locally-added (admin) stations stand out in amber */
.eth-marker.custom {
  background: #f59e0b;
}

/* ---------- Attribution ---------- */
.map-attribution {
  text-align: center;
  font-size: 12px;
  color: #6c757d;
  margin: 18px auto 0;
  max-width: 720px;
  line-height: 1.5;
}

.map-attribution a {
  color: #0563bb;
  text-decoration: none;
}

.map-attribution a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */

/* Tablet and below */
@media (max-width: 991.98px) {
  .ethanol-map { padding: 50px 0; }
  .map-card { padding: 26px 22px 30px; }
  .map-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .map-canvas { height: 420px; }
  .station-list { max-height: 360px; }
}

/* Small tablet / phablet — input wraps to its own row, buttons share row 2 */
@media (max-width: 767.98px) and (min-width: 576px) {
  .map-search-wrap { flex: 1 1 100%; }
  .map-search .search-button,
  .locate-button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Phone */
@media (max-width: 575.98px) {
  .ethanol-map { padding: 36px 0; }

  .ethanol-map .section-title h2 { font-size: 26px; }
  .ethanol-map .section-title .map-subtitle {
    font-size: 13.5px;
    padding: 0 6px;
  }

  .map-card {
    padding: 18px 14px 22px;
    border-radius: 6px;
    box-shadow: 0 4px 30px rgba(110, 123, 131, 0.08);
  }

  .map-controls {
    gap: 10px;
    margin-bottom: 14px;
  }

  /* Stack search controls vertically and make them full-width touch targets */
  .map-search {
    flex-direction: column;
    gap: 8px;
  }
  .map-search-wrap { flex: 1 1 100%; }
  .map-search-wrap input {
    /* 16px prevents iOS Safari from auto-zooming on focus */
    font-size: 16px;
    padding: 12px 12px 12px 0;
  }
  .map-search-wrap input::placeholder { font-size: 14px; }

  .map-search .search-button,
  .locate-button {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
  }

  .locate-button { border-radius: 8px; }
  .locate-button .locate-label-full { display: none; }
  .locate-button .locate-label-short { display: inline; }

  /* Filter row: stack each filter into its own row */
  .map-filter-row {
    padding: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .map-filter {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .map-filter select {
    flex: 1;
    min-height: 40px;
    font-size: 14px;
    padding: 8px 30px 8px 12px;
  }
  .map-toggle {
    padding: 6px 0;
    font-size: 13.5px;
  }

  /* Map + list compact heights */
  .map-canvas { height: 320px; }
  .map-list-pane { padding: 14px; }
  .map-list-title { font-size: 14px; }
  .station-list { max-height: 320px; }
  .station-card { padding: 12px 14px; }
  .station-card .station-name { font-size: 14px; }

  /* Meta footer stacks cleanly */
  .map-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .result-updated { font-style: normal; color: #6c757d; }

  /* Status bar: tighter padding */
  .map-status {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Keep Leaflet popup inside the viewport */
  .leaflet-popup-content {
    margin: 10px 12px !important;
    font-size: 12.5px !important;
    min-width: 0 !important;
    max-width: 220px !important;
  }
  .leaflet-popup-content .pop-name { font-size: 14px; }
  .leaflet-popup-content-wrapper { border-radius: 8px; }

  .map-attribution {
    font-size: 12px;
    padding: 0 4px;
  }
}

/* Very narrow phones (≤360px) */
@media (max-width: 360px) {
  .map-card { padding: 16px 12px 20px; }
  .ethanol-map .section-title h2 { font-size: 22px; }
  .map-canvas { height: 280px; }
  .station-list { max-height: 280px; }
}
