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

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #333;
  --text-light: #666;
  --border: #ddd;
  --shadow: 0 2px 8px rgba(0,0,0,0.15);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  height: 100%;
  width: 100%;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, transparent 100%);
  pointer-events: none;
}

#top-bar > * {
  pointer-events: auto;
}

#search-box {
  flex: 1;
  display: flex;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

#search-input {
  flex: 1;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  outline: none;
  background: transparent;
}

#btn-search {
  border: none;
  background: transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 18px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:active {
  transform: scale(0.95);
}

#sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 85%;
  max-width: 360px;
  z-index: 1001;
  background: var(--card);
  box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

#sidebar.hidden {
  transform: translateX(-100%);
}

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}

#sidebar-title {
  font-size: 18px;
  font-weight: 600;
}

#sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

#bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  max-height: 50vh;
  transition: transform 0.3s ease;
  overflow: hidden;
}

#bottom-sheet.hidden {
  transform: translateY(100%);
}

#bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto;
}

#bottom-sheet-content {
  padding: 0 16px 16px;
  overflow-y: auto;
  max-height: calc(50vh - 40px);
}

.result-item {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.result-item:active {
  background: #e0e0e0;
}

.result-item h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.result-item p {
  font-size: 13px;
  color: var(--text-light);
}

.prediction-card {
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid var(--primary);
}

.prediction-card .line-number {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.prediction-card .arrival-time {
  font-size: 14px;
  color: var(--text);
  margin-top: 4px;
}

.prediction-card .vehicle-info {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.stop-marker {
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
}

.bus-marker {
  color: var(--primary);
  font-size: 24px;
  text-align: center;
  line-height: 30px;
}

.leaflet-popup-content {
  margin: 8px 12px;
  font-size: 14px;
}

.leaflet-popup-content h4 {
  margin-bottom: 4px;
  color: var(--primary);
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
}

.error-msg {
  text-align: center;
  padding: 20px;
  color: #d32f2f;
}
