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

body {
  font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 40px 0;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
  font-size: 1rem;
  opacity: 0.9;
}

.search-section {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  margin-bottom: 20px;
}

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

#routeSearch {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.3s;
}

#routeSearch:focus {
  outline: none;
  border-color: #667eea;
}

#searchBtn, .secondary-btn {
  padding: 14px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

#searchBtn:hover, .secondary-btn:hover {
  background: #5568d3;
  transform: translateY(-1px);
}

.secondary-btn {
  background: #6c757d;
  font-size: 14px;
  padding: 8px 16px;
}

.secondary-btn:hover {
  background: #5a6268;
}

.route-results {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.route-card {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.route-card:hover {
  border-color: #667eea;
  background: #f0f2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.route-info {
  flex: 1;
}

.fav-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #ccc;
  transition: color 0.2s;
  padding: 4px 8px;
}

.fav-btn:hover {
  color: #ffc107;
}

.fav-btn.active {
  color: #ffc107;
}

.favorites-section {
  margin-bottom: 20px;
  padding: 16px;
  background: #fff8e1;
  border-radius: 12px;
  border: 2px solid #ffc107;
}

.favorites-section h3 {
  margin-bottom: 12px;
  color: #f57c00;
}

.route-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.route-dir {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 4px;
}

.stop-section {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.route-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e0e0e0;
}

.route-header h2 {
  font-size: 1.8rem;
  color: #333;
}

.stop-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.direction-group {
  margin-bottom: 16px;
}

.direction-header {
  font-size: 1.1rem;
  font-weight: bold;
  color: #667eea;
  padding: 10px 16px;
  background: #eef1ff;
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid #667eea;
}

.direction-group .stop-item {
  margin-left: 12px;
  border-left: 3px solid #e0e0e0;
  border-radius: 0 12px 12px 0;
}

.stop-item {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.stop-item:hover {
  border-color: #667eea;
  background: #f0f2ff;
}

.stop-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.estimate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.estimate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.estimate-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.estimate-plate {
  font-weight: bold;
  color: #667eea;
  font-size: 0.95rem;
}

.estimate-dest {
  font-size: 0.8rem;
  color: #888;
}

.estimate-time {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-minutes {
  font-size: 1.2rem;
  font-weight: bold;
  color: #28a745;
}

.time-minutes.urgent {
  color: #dc3545;
}

.time-minutes.warning {
  color: #ffc107;
}

.no-estimate {
  color: #999;
  font-style: italic;
}

.hidden {
  display: none !important;
}

.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #666;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

footer {
  text-align: center;
  padding: 30px 0;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  header h1 { font-size: 1.8rem; }
  .route-results { grid-template-columns: 1fr; }
  .route-header { flex-direction: column; gap: 10px; align-items: flex-start; }
}
