* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  direction: rtl;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  background: #fff;
}

:root {
  --accent: #FF6B6B;
  --accent-dark: #e55a5a;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 8px;
}

/* Top bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

#search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

#search-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius);
  font-size: 15px;
  direction: rtl;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: var(--accent);
}

#near-me-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

#near-me-btn:hover {
  background: var(--accent-dark);
}

#near-me-btn.active {
  background: #4285F4;
}

#near-me-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

#filters-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 900px;
  margin: 8px auto 0;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#region-select {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid #e0e0e0;
  font-size: 13px;
  direction: rtl;
  background: #fff;
  cursor: pointer;
  outline: none;
}

#online-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#online-toggle input {
  accent-color: var(--accent);
}

/* Layout */
#app {
  display: flex;
  height: 100%;
  padding-top: 110px;
}

#map {
  flex: 1;
  min-height: 300px;
}

#sidebar {
  width: 360px;
  background: #fafafa;
  border-right: 1px solid #eee;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar-header {
  padding: 12px 16px;
  font-size: 14px;
  color: #666;
  border-bottom: 1px solid #eee;
  background: #fff;
}

#store-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.store-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.store-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.14);
}

.store-card img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 6px;
  background: #f5f5f5;
  flex-shrink: 0;
}

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

.store-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-card-slogan {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-card-address {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.store-card.no-logo img {
  display: none;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f0f0f0;
  color: #666;
}

.badge.online {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge.location {
  background: #e3f2fd;
  color: #1565c0;
}

.badge.distance {
  background: #fff3e0;
  color: #e65100;
}

.badge.branches {
  background: #e8eaf6;
  color: #283593;
}

/* Info window */
.info-window {
  direction: rtl;
  font-family: inherit;
  max-width: 280px;
}

.info-window img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: #f5f5f5;
  margin-left: 10px;
  float: right;
}

.info-window h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.info-window .info-slogan {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.info-window .info-address {
  font-size: 13px;
  margin-bottom: 4px;
}

.info-window .info-links {
  font-size: 13px;
  margin-top: 6px;
}

.info-window .info-links a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 10px;
}

.info-window .info-links a:hover {
  text-decoration: underline;
}

.info-window .info-distance {
  font-size: 13px;
  color: #e65100;
  font-weight: 500;
  margin-bottom: 4px;
}

.info-window .info-phone {
  font-size: 13px;
  margin-bottom: 4px;
}

.info-window .info-nav {
  margin-top: 6px;
}

.info-window .info-nav a {
  color: #1a73e8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.info-window .info-nav a:hover {
  text-decoration: underline;
}

.info-window .info-categories {
  margin-top: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Loading */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-size: 18px;
  color: var(--accent);
}

#loading.hidden {
  display: none;
}

/* Multi-store info window */
.info-multi h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: #333;
}

.multi-list {
  max-height: 300px;
  overflow-y: auto;
}

.multi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}

.multi-item:last-child {
  border-bottom: none;
}

.multi-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

.multi-info {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.multi-info strong {
  font-size: 13px;
}

.multi-info a {
  color: #1a73e8;
  text-decoration: none;
}

.multi-links {
  display: inline-flex;
  gap: 4px;
  margin-right: 6px;
}

.multi-links a {
  text-decoration: none;
  font-size: 14px;
}

/* Mobile */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
    padding-top: 110px;
  }

  #map {
    height: 50vh;
    flex: none;
  }

  #sidebar {
    width: 100%;
    height: 50vh;
    border-right: none;
    border-top: 1px solid #eee;
  }

  #search-row {
    flex-wrap: wrap;
  }

  #search-input {
    min-width: 0;
  }
}
