/* ============================================================
   drive.css — Plan My Drive page styles.
   Matches Weather Compass glass card system.
   ============================================================ */

/* ===== Top bar ===== */
.drive-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--card-border);
  transition: background 200ms ease;
}
.drive-back:hover { background: rgba(255, 255, 255, 0.65); }

.drive-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-align: center;
  flex: 1;
}

/* ===== Input fields ===== */
.drive-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 14px 0 6px;
  opacity: 0.7;
}
.drive-label:first-of-type { margin-top: 0; }

.drive-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.drive-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.55);
  color: #10233a;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 200ms ease, background 200ms ease;
}
.drive-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.75);
}
.drive-input::placeholder { color: rgba(16, 35, 58, 0.5); }

.drive-locate {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 44px;
  text-align: center;
}

/* ===== Stops ===== */
.drive-stop-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.drive-stop-row .drive-input { flex: 1; }
.drive-remove-stop {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 36px;
  text-align: center;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  border-radius: 10px;
}
.drive-remove-stop:hover { background: rgba(220, 38, 38, 0.2); }

.drive-add-stop {
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed var(--card-border);
  border-radius: 10px;
  width: 100%;
}

/* ===== Depart time ===== */
.drive-depart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.drive-depart-row .drive-label {
  margin: 0;
  min-width: 50px;
}
.drive-select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.55);
  color: #10233a;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
}
.drive-datetime {
  flex: 1;
  min-width: 180px;
}

/* ===== Go button ===== */
.drive-go-btn {
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  transition: background 200ms ease, opacity 200ms ease, transform 120ms ease;
}
.drive-go-btn:hover { background: #245a9e; }
.drive-go-btn:active { transform: scale(0.98); }
.drive-go-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.drive-go-btn.loading {
  position: relative;
  color: transparent;
}
.drive-go-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: drive-spin 0.7s linear infinite;
}
@keyframes drive-spin {
  to { transform: rotate(360deg); }
}

/* ===== Trip summary ===== */
.trip-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}
.trip-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trip-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.trip-stat-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

/* Legs breakdown */
.trip-legs { margin-top: 16px; }
.trip-leg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
}
.trip-leg:last-child { border-bottom: none; }
.trip-leg-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}
.trip-leg-text { flex: 1; }
.trip-leg-dist {
  font-weight: 700;
  font-size: 0.82rem;
  opacity: 0.7;
  white-space: nowrap;
}

/* ===== Map ===== */
.drive-map-card { padding: 20px 20px 12px; }
.drive-map {
  width: 100%;
  height: 380px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
}
.drive-map-controls {
  display: flex;
  gap: 6px;
}
.drive-map-toggle {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
}
.drive-map-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.map-legend {
  display: flex;
  gap: 16px;
  padding: 10px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.7;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot-primary { background: #2b6cb0; }
.legend-dot-alt { background: #9ca3af; }

/* ===== Directions list ===== */
.directions-list {
  max-height: 400px;
  overflow-y: auto;
  transition: max-height 300ms ease;
}
.directions-list.collapsed {
  max-height: 0;
  overflow: hidden;
}
.drive-collapse-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  line-height: 32px;
  text-align: center;
  transition: transform 200ms ease;
}
.drive-collapse-btn.rotated { transform: rotate(180deg); }

.dir-step {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  line-height: 1.45;
}
.dir-step:last-child { border-bottom: none; }
.dir-step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}
.dir-step-text { flex: 1; }
.dir-step-dist {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.6;
  white-space: nowrap;
  margin-top: 2px;
}

/* ===== Footer ===== */
.fine {
  font-size: 0.72rem;
  opacity: 0.5;
  line-height: 1.5;
  padding: 20px 0;
}
.center { text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .drive-map { height: 300px; }
  .trip-summary-grid { gap: 8px; }
  .trip-stat-val { font-size: 1.15rem; }
  .drive-depart-row { flex-direction: column; align-items: stretch; }
  .drive-depart-row .drive-label { min-width: auto; }
}

/* ===== Location error ===== */
.location-error {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  text-align: center;
}
.location-error-msg {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #fca5a5;
  margin-bottom: 10px;
}
.location-error-retry {
  padding: 10px 24px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.location-error-retry:active { background: #b91c1c; }

/* ===== Clear trip button ===== */
.drive-clear-btn {
  margin-top: 8px;
  width: 100%;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.drive-clear-btn:hover {
  color: #f87171;
  border-color: rgba(248,113,113,0.4);
}

/* ===== Weather along route ===== */
.weather-route-status {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 8px;
}
.weather-route-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
}
.weather-route-cards::-webkit-scrollbar { height: 4px; }
.weather-route-cards::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
}

.wr-card {
  flex: 0 0 auto;
  width: 155px;
  padding: 14px;
  border-radius: 14px;
  scroll-snap-align: start;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.15);
  transition: transform 150ms ease;
}
.wr-card:hover { transform: translateY(-2px); }

.wr-card.wr-green  { background: rgba(34,197,94,0.25); }
.wr-card.wr-yellow { background: rgba(234,179,8,0.25); }
.wr-card.wr-red    { background: rgba(239,68,68,0.25); }

.wr-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wr-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 4px;
}
.wr-temp {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.wr-desc {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.8;
}
.wr-details {
  margin-top: 8px;
  font-size: 0.72rem;
  line-height: 1.6;
  opacity: 0.7;
}
.wr-eta {
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.5;
  text-transform: uppercase;
}

/* ===== Google autocomplete dropdown styling ===== */
.pac-container {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin-top: 4px;
  z-index: 9999;
}
.pac-item {
  padding: 10px 14px;
  font-size: 0.92rem;
  cursor: pointer;
}
.pac-item:hover {
  background: rgba(43, 108, 176, 0.08);
}

/* ===== keep map alive in dom when hidden ===== */
#map-card[hidden] {
  display: block !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
