/* =========================================================
   Ofogh Kourosh Store Locator
   WebJs + Leaflet
   ========================================================= */

:root {
  --bg: #f8f6f6;
  --surface: #ffffff;
  --surface-soft: #fbf8f8;
  --text: #211616;
  --text-secondary: #746666;
  --text-light: #a18f8f;
  --primary: #c62828;
  --primary-dark: #a61f1f;
  --primary-soft: #fdeaea;
  --border: #eadede;
  --border-dark: #dbc8c8;
  --danger: #dc2626;
  --shadow-sm: 0 4px 14px rgba(80, 25, 25, 0.06);
  --shadow-md: 0 12px 32px rgba(80, 25, 25, 0.09);
  --shadow-lg: 0 24px 55px rgba(80, 25, 25, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

/* =========================================================
   Reset
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;

  background:
    radial-gradient(
      circle at top left,
      rgba(198, 40, 40, 0.07),
      transparent 30%
    ),
    var(--bg);

  color: var(--text);
  line-height: 1.5;

  transition:
    background 0.25s ease,
    color 0.25s ease;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(198, 40, 40, 0.2);

  outline-offset: 2px;
}

/* =========================================================
   Page
   ========================================================= */

.page-shell {
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 46px 0 30px;
}

/* =========================================================
   Hero
   ========================================================= */

.hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(198, 40, 40, 0.14);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 700px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.75;
}

/* =========================================================
   Hero Actions
   ========================================================= */

.hero-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mode-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.mode-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.mode-button:active {
  transform: translateY(0);
}

/* =========================================================
   Hero Stat
   ========================================================= */

.hero-stat {
  min-width: 135px;
  margin-top: 60px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.hero-stat strong {
  color: var(--primary);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.hero-stat span {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

/* =========================================================
   Locator Card
   ========================================================= */

.locator-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

store-map {
  display: block;
  width: 100%;
}

/* =========================================================
   Locator Grid
   ========================================================= */

.locator-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: 720px;
}

/* =========================================================
   Store Panel
   ========================================================= */

.store-panel {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

/* =========================================================
   Panel Heading
   ========================================================= */

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-heading > div {
  min-width: 0;
}

.panel-kicker {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.panel-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.result-count {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

/* =========================================================
   Search
   ========================================================= */

.search-box {
  position: relative;
  display: block;
  width: 100%;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-light);
  stroke-width: 1.8;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 45px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.search-box input::placeholder {
  color: #9a8b8b;
}

.search-box input:hover {
  border-color: var(--border-dark);
}

.search-box input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.09);
}

/* =========================================================
   Filters
   ========================================================= */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 18px;
}

.filter-chip {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--border-dark);
  background: var(--surface-soft);
  color: var(--text);
}

.filter-chip:active {
  transform: scale(0.97);
}

.filter-chip.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

/* =========================================================
   Store List
   ========================================================= */

.store-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 555px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.store-list::-webkit-scrollbar {
  width: 5px;
}

.store-list::-webkit-scrollbar-track {
  background: transparent;
}

.store-list::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background: #d8c7c7;
}

.store-list::-webkit-scrollbar-thumb:hover {
  background: #c5aeae;
}

/* =========================================================
   Store Item
   ========================================================= */

.store-item {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.store-item:hover {
  transform: translateY(-1px);
  border-color: var(--border);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.store-item.is-selected {
  border-color: rgba(198, 40, 40, 0.25);
  background: var(--primary-soft);
}

/* =========================================================
   Store Icon
   ========================================================= */

.store-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 15px;
  font-weight: 800;
}

/* =========================================================
   Store Info
   ========================================================= */

.store-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.store-info strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-info span {
  margin-top: 2px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 650;
}

.store-info small {
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   Arrow
   ========================================================= */

.arrow {
  display: grid;
  place-items: center;
  color: #a28f8f;
  font-size: 17px;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.store-item:hover .arrow {
  color: var(--primary);
  transform: translate(2px, -2px);
}

/* =========================================================
   Empty State
   ========================================================= */

.empty-state {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1px dashed var(--border-dark);
  border-radius: 14px;
  background: var(--surface-soft);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
}

.empty-state span {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* =========================================================
   Map
   ========================================================= */

.map-panel {
  position: relative;
  min-width: 0;
  min-height: 720px;
  background: #ece5e5;
}

.map-toolbar {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 500;
  display: flex;
  gap: 8px;
}

.map-control {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(80, 25, 25, 0.12);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.map-control:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.map-control:active {
  transform: translateY(0);
}

.map-control-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.map-control-primary:hover {
  background: var(--primary-dark);
}

/* =========================================================
   Leaflet Map
   ========================================================= */

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 720px;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  min-height: 720px;
  font-family: inherit;
  background: #e8e1e1;
}

/* =========================================================
   Leaflet Controls
   ========================================================= */

.leaflet-control-zoom {
  margin-right: 14px !important;
  margin-bottom: 45px !important;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9) !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 18px rgba(80, 25, 25, 0.12) !important;
}

.leaflet-control-zoom a {
  width: 34px !important;
  height: 34px !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: var(--text) !important;
  border: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}

/* =========================================================
   Map Caption
   ========================================================= */

.map-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.93);
  border-top: 1px solid rgba(234, 222, 222, 0.9);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.4;
}

.map-caption span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--primary);
}

/* =========================================================
   Popup
   ========================================================= */

.map-popup {
  min-width: 210px;
  padding: 2px;
}

.popup-type {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-popup h3 {
  margin: 10px 0 5px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.map-popup p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.popup-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
}

.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(80, 25, 25, 0.16);
}

.leaflet-popup-content {
  margin: 14px;
}

.leaflet-popup-tip {
  box-shadow: none;
}

/* =========================================================
   Accessibility
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 4px 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.site-footer span:first-child {
  color: var(--text);
  font-weight: 750;
}

.site-footer span:last-child {
  color: var(--text-light);
}

/* =========================================================
   DARK MODE
   ========================================================= */

html[data-theme="dark"] {
  --bg: #171313;
  --surface: #211a1a;
  --surface-soft: #291f1f;
  --text: #f7eeee;
  --text-secondary: #c3b1b1;
  --text-light: #958181;
  --primary: #ef5350;
  --primary-dark: #d93636;
  --primary-soft: #3a2020;
  --border: #3b2d2d;
  --border-dark: #4b3838;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 55px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(
      circle at top left,
      rgba(198, 40, 40, 0.13),
      transparent 32%
    ),
    var(--bg);

  color: var(--text);
}

html[data-theme="dark"] .hero-stat {
  background: rgba(33, 26, 26, 0.9);
}

html[data-theme="dark"] .store-item:hover {
  background: var(--surface-soft);
}

html[data-theme="dark"] .map-panel {
  background: #282020;
}

html[data-theme="dark"] .leaflet-container {
  background: #282020;
}

html[data-theme="dark"] .map-control {
  background: rgba(33, 26, 26, 0.95);

  color: var(--text);

  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .map-control:hover {
  background: #302424;
}

html[data-theme="dark"] .leaflet-control-zoom a {
  background: rgba(33, 26, 26, 0.96) !important;

  color: var(--text) !important;
}

html[data-theme="dark"] .leaflet-control-zoom a:hover {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}

html[data-theme="dark"] .map-caption {
  background: rgba(33, 26, 26, 0.94);
  border-color: var(--border);
}

html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip {
  background: var(--surface);

  color: var(--text);
}

/* =========================================================
   RTL
   ========================================================= */

html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .hero {
  direction: rtl;
}

html[dir="rtl"] .hero-actions {
  right: auto;
  left: 0;
  direction: rtl;
}

html[dir="rtl"] .store-panel {
  border-right: 0;
  border-left: 1px solid var(--border);
}

html[dir="rtl"] .store-item {
  text-align: right;
}

html[dir="rtl"] .store-info {
  text-align: right;
}

html[dir="rtl"] .search-box input {
  padding: 0 45px 0 16px;
}

html[dir="rtl"] .search-box svg {
  left: auto;
  right: 15px;
}

html[dir="rtl"] .map-toolbar {
  left: auto;
  right: 18px;
}

html[dir="rtl"] .map-caption {
  direction: rtl;
}

html[dir="rtl"] .site-footer {
  direction: rtl;
}

html[dir="rtl"] .store-item:hover .arrow {
  transform: translate(-2px, -2px);
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {
  .page-shell {
    width: min(100% - 32px, 1380px);
    padding-top: 32px;
  }

  .locator-grid {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .store-panel {
    padding: 20px;
  }

  .locator-grid,
  .map-panel,
  .map-canvas,
  .leaflet-container {
    min-height: 650px;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 700px);
    padding: 24px 0;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .hero-actions {
    position: static;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .toggle-area {
    position: absolute;
    top: 0;
  }

  .hero-stat {
    margin-top: 0;
    flex: 0;
  }

  html[dir="rtl"] .hero-actions {
    justify-content: flex-end;
  }

  .hero-stat span {
    margin: 0;
  }

  .locator-grid {
    grid-template-columns: 1fr;
  }

  .store-panel {
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  .store-list {
    max-height: 300px;
  }

  .map-panel {
    min-height: 500px;
  }

  .map-canvas,
  .leaflet-container {
    min-height: 500px;
  }

  .map-caption {
    font-size: 9px;
  }

  .map-caption span:last-child {
    display: none;
  }

  html[dir="rtl"] .store-panel {
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  html[dir="rtl"] .map-toolbar {
    right: 12px;
    left: auto;
  }
}

/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {
  .page-shell {
    width: calc(100% - 16px);
    padding: 16px 0 20px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero p {
    margin-top: 14px;
    font-size: 14px;
  }

  .hero-actions {
    gap: 6px;
  }

  .mode-button {
    padding: 8px 10px;
    font-size: 11px;
  }

  .hero-stat {
    min-width: 110px;
    padding: 16px;
  }

  .locator-card {
    border-radius: 18px;
  }

  .store-panel {
    padding: 16px;
  }

  .panel-heading h2 {
    font-size: 19px;
  }

  .filter-row {
    gap: 6px;
  }

  .filter-chip {
    padding: 7px 10px;
    font-size: 11px;
  }

  .store-item {
    grid-template-columns:
      34px minmax(0, 1fr)
      18px;
    gap: 10px;
    padding: 11px;
  }

  .store-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .store-info strong {
    font-size: 12px;
  }

  .store-info span,
  .store-info small {
    font-size: 10px;
  }

  .map-panel,
  .map-canvas,
  .leaflet-container {
    min-height: 420px;
  }

  .map-toolbar {
    top: 12px;
    left: 12px;
  }

  .map-control {
    padding: 8px 10px;
    font-size: 11px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}
