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

:root {
  --honey: #f5a623;
  --honey-dark: #d4891a;
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --green: #2ecc71;
  --amber: #f39c12;
  --red: #e74c3c;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
header {
  padding: 0.75rem 1rem;
  background: var(--honey);
  color: #fff;
  text-align: center;
}
header h1 { font-size: 1.25rem; }
.tagline { font-size: 0.8rem; opacity: 0.9; }

/* Search Bar */
.search-bar {
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.search-inputs {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  max-width: 900px;
  margin: 0 auto;
}
.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.input-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}
.input-group input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus {
  border-color: var(--honey);
}
.location-wrapper {
  display: flex;
  gap: 0.25rem;
}
.location-wrapper input { flex: 1; }
#geolocate-btn {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
#geolocate-btn:hover { background: #f0f0f0; }
.btn-primary {
  padding: 0.5rem 1.25rem;
  background: var(--honey);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--honey-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Main Layout */
main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Results Panel */
.results-panel {
  width: 350px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.results-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.results-header h2 { font-size: 1rem; }
#results-count { font-size: 0.8rem; color: var(--text-muted); }
.results-list { flex: 1; overflow-y: auto; }
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* Result Item */
.result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.result-item:hover { background: #fef9f0; }
.result-item.active { background: #fef3e0; border-left: 3px solid var(--honey); }
.result-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.rank-fast { background: var(--green); }
.rank-medium { background: var(--amber); }
.rank-slow { background: var(--red); }
.rank-none { background: #999; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-weight: 600; font-size: 0.9rem; }
.result-time { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.result-modes { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Loading */
.loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--honey);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* Utilities */
.hidden { display: none !important; }

/* Mobile */
@media (max-width: 768px) {
  main {
    flex-direction: column-reverse;
  }
  .results-panel {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-top: 1px solid var(--border);
  }
  .search-inputs {
    flex-direction: column;
  }
  .search-inputs .btn-primary {
    width: 100%;
  }
}
