:root {
  --bg: #ece4d7;
  --ink: #16221c;
  --muted: #5a685f;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-strong: #fff8ef;
  --line: rgba(22, 34, 28, 0.12);
  --accent: #c4622d;
  --accent-deep: #934319;
  --available: #1f8f51;
  --empty: #c74436;
  --unknown: #7c7f85;
  --shadow: 0 22px 50px rgba(34, 32, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(196, 98, 45, 0.15), transparent 24rem),
    linear-gradient(180deg, #f3ecdf 0%, #e4dccd 100%);
}

html[dir="rtl"] body {
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", "IBM Plex Sans", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.map-app {
  position: relative;
  min-height: 100vh;
}

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.topbar,
.panel,
.station-sheet {
  backdrop-filter: blur(14px);
}

.overlay-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 1.05rem;
}

.eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-deep);
}

.logo,
.panel h3,
.station-sheet h2 {
  font-family: "Space Grotesk", sans-serif;
}

.logo {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.toolbar {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.brand-block {
  min-width: 0;
}

.control-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.control-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.header-filter,
.language-picker,
.ghost-button,
.primary-button,
.panel,
.map-shell,
.station-sheet {
  border-radius: 1.25rem;
}

.header-filter,
.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--panel);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
}

.header-filter {
  min-width: 9rem;
}

.header-filter span,
.language-picker span {
  white-space: nowrap;
}

.header-filter select,
.language-picker select,
#station-search,
#fuel-type-select,
#fuel-status-select {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

.ghost-button,
.primary-button {
  border: none;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease;
}

.ghost-button {
  background: rgba(255, 248, 239, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff9f2;
  box-shadow: 0 12px 26px rgba(147, 67, 25, 0.25);
}

.ghost-button:hover,
.primary-button:hover,
.station-row:hover {
  transform: translateY(-1px);
}

.layout {
  display: block;
}

.hero-copy,
.muted,
.sheet-address,
.sheet-updated {
  color: var(--muted);
}

.status-legend,
.legend-items {
  display: grid;
  gap: 0.65rem;
  min-width: 12rem;
}

.status-legend div,
.legend-items div,
.station-meta,
.fuel-chip,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pin-shape {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.45rem;
  flex: 0 0 auto;
}

.pin-available {
  background: var(--available);
  border-radius: 50%;
}

.pin-empty {
  background: var(--empty);
  transform: rotate(45deg);
}

.pin-unknown {
  background: var(--unknown);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.panel {
  padding: 1rem;
}

.search-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.station-row {
  padding: 0.9rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 34, 28, 0.08);
  cursor: pointer;
}

.station-row h4 {
  margin: 0 0 0.35rem;
}

.station-row p {
  margin: 0;
}

.status-pill {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill.available {
  background: rgba(31, 143, 81, 0.12);
  color: var(--available);
}

.status-pill.empty {
  background: rgba(199, 68, 54, 0.12);
  color: var(--empty);
}

.status-pill.unknown {
  background: rgba(124, 127, 133, 0.14);
  color: var(--unknown);
}

.map-overlay {
  position: fixed;
  top: 5.85rem;
  right: 1rem;
  z-index: 650;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(255, 248, 239, 0.92);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--ink);
}

.map-status-spinner {
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 50%;
  border: 2px solid rgba(22, 34, 28, 0.18);
  border-top-color: var(--accent-deep);
  animation: spin 700ms linear infinite;
}

.map-overlay.is-message .map-status-spinner {
  display: none;
}

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

.legend-panel {
  position: fixed;
  left: 1rem;
  bottom: 4.5rem;
  z-index: 650;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
}

.legend-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 651;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
  color: var(--ink);
  padding: 0.58rem 0.9rem;
  cursor: pointer;
}

.station-sheet {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: min(26rem, calc(100vw - 2rem));
  padding: 1.25rem;
  z-index: 900;
  max-height: min(82vh, 44rem);
  overflow: auto;
  border-radius: 1.25rem;
}

html[dir="rtl"] .topbar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .toolbar,
html[dir="rtl"] .station-meta,
html[dir="rtl"] .fuel-chip,
html[dir="rtl"] .panel-heading,
html[dir="rtl"] .sheet-actions {
  direction: rtl;
}

html[dir="rtl"] .map-overlay {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .legend-panel,
html[dir="rtl"] .legend-toggle {
  left: auto;
  right: 1rem;
}

html[dir="rtl"] .station-sheet {
  right: auto;
  left: 1.25rem;
}

html[dir="rtl"] .sheet-close {
  right: auto;
  left: 0.85rem;
}

html[dir="rtl"] .sheet-address,
html[dir="rtl"] .sheet-updated,
html[dir="rtl"] .fuel-meta,
html[dir="rtl"] #report-form,
html[dir="rtl"] .report-panel {
  text-align: right;
}

html[dir="rtl"] .pin-shape {
  margin-right: 0;
  margin-left: 0.45rem;
}

.hidden {
  display: none;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 34, 28, 0.22);
  z-index: 850;
}

.sheet-close {
  position: absolute;
  right: 0.85rem;
  top: 0.85rem;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--muted);
}

.fuel-grid {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.fuel-chip {
  padding: 0.8rem 0.95rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(22, 34, 28, 0.08);
  border-radius: 1rem;
}

.sheet-actions,
#report-form {
  display: grid;
  gap: 0.75rem;
}

.report-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.submit-button {
  margin-top: 0.5rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 1rem;
}

.custom-pin {
  width: 1.05rem;
  height: 1.05rem;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
  border: 3px solid rgba(255, 255, 255, 0.9);
}

.custom-pin.available {
  background: var(--available);
  border-radius: 50%;
}

.custom-pin.empty {
  background: var(--empty);
  transform: rotate(45deg);
}

.custom-pin.unknown {
  background: var(--unknown);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

@media (max-width: 960px) {
  .topbar {
    right: 0.75rem;
    left: 0.75rem;
    top: 0.75rem;
    padding: 0.75rem 0.85rem;
  }

  .status-legend,
  .legend-items {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    font-size: 0.82rem;
  }

  .status-legend div,
  .legend-items div {
    justify-content: flex-start;
    padding: 0.45rem 0.55rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.5);
  }

  .pin-shape {
    width: 0.72rem;
    height: 0.72rem;
    margin-right: 0.35rem;
  }

  .station-sheet {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 0.75rem;
    max-height: 76vh;
  }
}

@media (max-width: 640px) {
  body.sheet-open .topbar,
  body.sheet-open .legend-panel,
  body.sheet-open .legend-toggle,
  body.sheet-open .map-overlay {
    display: none;
  }

  .topbar {
    top: auto;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    gap: 0;
    align-items: center;
    justify-content: center;
    padding: 0.42rem;
    border-radius: 0.95rem;
    background: rgba(255, 248, 239, 0.94);
    z-index: 820;
  }

  .brand-block {
    display: none;
  }

  .toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(4.4rem, 0.72fr) 3.2rem;
    gap: 0.38rem;
    align-items: center;
  }

  .header-filter,
  .language-picker,
  .ghost-button {
    width: auto;
    min-width: 0;
    justify-content: space-between;
    padding: 0.32rem 0.42rem;
    border-radius: 0.8rem;
  }

  .header-filter,
  .language-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: center;
  }

  .header-filter span,
  .language-picker span {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .header-filter > span[data-i18n] {
    display: none;
  }

  .language-picker > span[data-i18n] {
    display: none;
  }

  .header-filter select,
  .language-picker select {
    padding: 0.42rem 0.5rem;
    font-size: 0.82rem;
    min-height: 2rem;
  }

  .language-picker select {
    min-width: 0;
    text-align: center;
    font-weight: 600;
  }

  #locate-button {
    min-height: 100%;
    min-width: 0;
    justify-content: center;
    padding: 0.52rem;
  }

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

  #locate-button .control-icon svg {
    width: 1.1rem;
    height: 1.1rem;
  }

  .status-legend,
  .legend-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    font-size: 0.72rem;
  }

  .status-legend div,
  .legend-items div {
    padding: 0.32rem 0.42rem;
    justify-content: center;
  }

  .map-overlay {
    top: 0.75rem;
    right: 0.75rem;
    max-width: min(15rem, calc(100vw - 1.5rem));
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
  }

  .legend-panel {
    bottom: 4.15rem;
  }

  .legend-toggle {
    bottom: 0.75rem;
  }

  .station-sheet {
    inset: 0;
    width: 100vw;
    max-height: 100vh;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1rem 1.25rem;
    border-radius: 0;
  }

  html[dir="rtl"] .map-overlay {
    right: auto;
    left: 0.75rem;
  }
}
