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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #333;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: #00A4EF;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 4px;
  overflow: hidden;
}

.search-box input {
  border: none;
  padding: 10px 15px;
  font-size: 16px; /* Prevents iOS zoom on focus */
  width: 250px;
  max-width: 100%;
  outline: none;
}

.search-box button {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.3s;
}

.search-box button:hover {
  background: #2980b9;
}

.btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.3s;
}

.btn:hover {
  background: #219a52;
}

.btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 350px;
  background: white;
  border-right: 1px solid #ddd;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.sidebar.visible {
  display: flex;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.results-count {
  font-size: 14px;
  color: #666;
}

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

.retailer-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.retailer-item:hover {
  background: #f8f9fa;
}

.retailer-item.active {
  background: #e8f4fc;
  border-left: 3px solid #3498db;
}

.retailer-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.retailer-address {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.retailer-phone {
  font-size: 13px;
  color: #555;
  margin-top: 5px;
}

.retailer-distance {
  font-size: 12px;
  color: #3498db;
  margin-top: 5px;
  font-weight: 500;
}

/* Map */
.map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Loading Spinner */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error State */
.error-message {
  text-align: center;
  padding: 40px;
  color: #e74c3c;
}

.error-message h2 {
  margin-bottom: 10px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Info Window */
.info-window {
  padding: 5px;
  min-width: 200px;
}

.info-window h3 {
  margin: 0 0 8px 0;
  color: #2c3e50;
  font-size: 16px;
}

.info-window p {
  margin: 0 0 5px 0;
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

.info-window a {
  color: #3498db;
  text-decoration: none;
  font-size: 13px;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .header {
    padding: 10px;
    width: 100%;
  }

  .header h1 {
    font-size: 1.2rem;
    width: 100%;
  }

  .search-container {
    width: 100%;
  }

  .search-box {
    flex: 1;
    min-width: 0;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
  }

  .main-content {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 40%;
    border-right: none;
    border-bottom: 1px solid #ddd;
    order: 2;
  }

  .sidebar.visible {
    display: flex;
  }

  .map-container {
    height: 60%;
    order: 1;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 8px;
  }

  .search-container {
    flex-direction: column;
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}
