:root {
  --red: #e2231a;
  --red-dark: #b81b14;
  --green: #1a8a3c;
  --text: #1d1d1d;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --bg: #ffffff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  --sidebar-width: 380px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 500;
}

.search-bar {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--red);
}

.search-bar button {
  padding: 0 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.search-bar button:hover {
  background: var(--red-dark);
}

.store-list {
  flex: 1;
  overflow-y: auto;
}

.status-msg {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Store card (sidebar) ---------- */
.store-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.store-item:hover,
.store-item.active {
  background: #faf7f7;
}

.store-item .thumb {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: #f0f0f0;
}

.store-item .info {
  flex: 1;
  min-width: 0;
}

.store-item .name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.store-item .status {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
}

.status.open {
  color: var(--green);
}

.status.closed {
  color: var(--red);
}

.store-item .addr,
.store-item .phone {
  font-size: 12.5px;
  color: var(--muted);
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outlet-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--red);
  border-radius: 3px;
}

/* ---------- Map ---------- */
#map {
  flex: 1;
  height: 100%;
}

/* Custom red pin marker */
.store-pin {
  width: 30px;
  height: 42px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

/* ---------- Popup card ---------- */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

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

.popup-card .cover {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #f0f0f0;
  display: block;
}

.popup-card .body {
  padding: 12px 14px 14px;
}

.popup-card .name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
}

.popup-card .meters {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
}

.popup-card .status {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
}

.popup-card .actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.popup-card .actions a {
  flex: 1;
  text-align: center;
  padding: 9px 6px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.popup-card .btn-primary {
  background: var(--red);
  color: #fff;
}

.popup-card .btn-primary:hover {
  background: var(--red-dark);
}

.popup-card .btn-outline {
  border: 1px solid var(--red);
  color: var(--red);
}

.popup-card .meta {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0;
  line-height: 1.4;
}

.popup-card .meta a {
  color: var(--muted);
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  #app {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    min-width: 0;
    height: 45%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #map {
    height: 55%;
  }
}
