/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  color: #333;
  background: #f0f2f5;
}

/* ============================================================
   Layout
   ============================================================ */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */
#sidebar {
  width: 320px;
  min-width: 280px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 2px 0 12px rgba(0,0,0,0.10);
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-header {
  background: #1a3a5c;
  color: #fff;
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#logo {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
}

.sidebar-header h1 {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3px;
}

/* ============================================================
   Sections inside sidebar
   ============================================================ */
.section {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.section-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888;
  margin-bottom: 8px;
}

/* ============================================================
   School Select
   ============================================================ */

#school-select,
#schedule-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: auto;
}

#school-select:focus,
#schedule-select:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26,58,92,0.12);
}

/* ============================================================
   Address Search
   ============================================================ */
.search-wrapper {
  position: relative;
}

#address-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

#address-input:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26,58,92,0.12);
}

.hint {
  font-size: 11px;
  color: #aaa;
  margin-top: 6px;
}

/* ============================================================
   Suggestions Dropdown
   ============================================================ */
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 2000;
}

.suggestions.hidden {
  display: none;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #eef3fa;
  color: #1a3a5c;
}

.suggestion-item.no-results {
  color: #999;
  cursor: default;
}

.suggestion-item.no-results:hover {
  background: none;
}

/* Loading spinner text */
.suggestion-item.loading {
  color: #aaa;
  font-style: italic;
  cursor: default;
}

.suggestion-item.loading:hover {
  background: none;
  color: #aaa;
}

/* ============================================================
   Location info card
   ============================================================ */
.info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eef3fa;
  border: 1px solid #c5d8f0;
  border-radius: 8px;
  padding: 10px 12px;
  gap: 8px;
}

#info-label {
  font-size: 13px;
  color: #1a3a5c;
  flex: 1;
  line-height: 1.4;
}

#clear-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}

#clear-btn:hover {
  color: #c0392b;
  background: #fde8e8;
}

.hidden {
  display: none !important;
}

/* ============================================================
   Find Route Button
   ============================================================ */
#find-route-btn {
  width: 100%;
  padding: 10px 12px;
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s;
}

#find-route-btn:hover {
  background: #14305a;
}

#find-route-btn:disabled {
  background: #a0b0c4;
  cursor: not-allowed;
}

/* ============================================================
   Route Info Panel
   ============================================================ */
.route-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

#route-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a3a5c;
  flex: 1;
  line-height: 1.4;
}

#clear-route-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}

#clear-route-btn:hover {
  color: #c0392b;
  background: #fde8e8;
}

#route-stops {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.route-stop-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.route-stop-item:hover {
  background: #eef3fa;
  border-color: #c5d8f0;
}

.stop-seq {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: #1a3a5c;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}

.stop-addr {
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  flex: 1;
}

.stop-time {
  font-size: 11px;
  color: #888;
  margin-left: 4px;
}

/* ============================================================
   Map
   ============================================================ */
#map {
  flex: 1;
  height: 100%;
}

/* ============================================================
   Version badge
   ============================================================ */
#app-version {
  padding: 8px 16px 10px;
  font-size: 11px;
  color: #b0b8c4;
  text-align: right;
  letter-spacing: 0.04em;
  user-select: none;
}

/* ============================================================
   Responsive – stack on narrow screens
   ============================================================ */
@media (max-width: 640px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    min-width: unset;
    max-height: 45vh;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  }

  #map {
    height: 55vh;
  }
}
