/* ── MODAL ── */
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: calc(var(--bottom) + var(--safe-bottom)); z-index: 40; background: rgba(12,22,34,0.65); backdrop-filter: blur(3px); display: none; align-items: flex-end; }
.modal-overlay.open { display: flex; }
.route-modal { background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; width: 100%; max-height: 80%; overflow-y: auto; padding-bottom: 0; animation: slideUp 0.26s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: 0 -8px 32px rgba(0,0,0,0.18); }
@keyframes slideUp { from { transform: translateY(28px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
.modal-handle { width: 30px; height: 3px; border-radius: 2px; background: var(--border-strong); margin: 11px auto 0; }
.modal-body { padding: 18px; }
.modal-driver-section { display: flex; align-items: center; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--border); margin-bottom: 15px; }
.modal-av { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-body); font-size: 17px; font-weight: 600; color: #fff; flex-shrink: 0; }
.modal-driver-name { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.1px; }
.modal-rating { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--amber); font-weight: 600; margin-top: 3px; }
.modal-section-label { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.modal-route-visual { background: var(--bg); border-radius: var(--r-sm); padding: 13px; margin-bottom: 15px; border: 1px solid var(--border); }
.modal-stop { display: flex; gap: 10px; align-items: flex-start; padding-bottom: 11px; }
.modal-stop:last-child { padding-bottom: 0; }
.modal-stop-line { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.modal-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface); }
.modal-dot.a { background: var(--accent); }
.modal-dot.b { background: var(--green); }
.modal-connector { width: 1px; height: 20px; background: var(--border-strong); margin: 2px 0; }
.modal-stop-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.modal-stop-time { font-size: 12px; color: var(--ink-muted); }
.modal-prefs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; }
.modal-notes { background: var(--bg); border-left: 2px solid var(--border-strong); padding: 11px 13px; margin-bottom: 15px; font-size: 13px; color: var(--ink-mid); line-height: 1.6; font-style: italic; }
.modal-actions { display: flex; gap: 8px; position: sticky; bottom: 0; background: var(--surface); padding: 14px 18px 16px; margin: 4px -18px 0; border-top: 1px solid var(--border); }
.modal-msg-btn { flex: 1; height: 42px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--ink-mid); cursor: pointer; transition: background 0.12s; }
.modal-msg-btn:hover { background: var(--surface2); }
.modal-join-btn { flex: 2; height: 42px; background: var(--accent); color: #fff; border: none; border-radius: var(--r-sm); font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.12s; letter-spacing: 0.1px; }
.modal-join-btn:hover { background: var(--accent-dark); }
.modal-join-btn:active { transform: scale(0.97); }
.modal-join-btn.joined { background: var(--green); }
.modal-join-btn.mine { background: var(--bg); color: var(--ink-faint); border: 1px solid var(--border); cursor: default; }

/* ── BOTTOM NAV ── */
.bottomnav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--bottom) + var(--safe-bottom));
  display: flex; align-items: flex-start;
  padding-top: 8px;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  /* Prevent browser chrome from covering it */
  padding-bottom: max(var(--safe-bottom), env(safe-area-inset-bottom, 16px));
}
.nav-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; cursor: pointer; border: none; background: none; font-family: var(--font-body); color: var(--ink-faint); transition: color 0.12s; padding-bottom: 0; position: relative; }
.nav-tab .ti { font-size: 19px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.nav-tab .tl { font-size: 9px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; }
.nav-tab.active { color: var(--accent); }
.nav-tab::after { content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px; opacity: 0; transition: opacity 0.15s; }
.nav-tab.active::after { opacity: 1; }

/* ── LOADING / EMPTY / TOAST ── */
.loading-state { display: flex; align-items: center; justify-content: center; padding: 60px; flex-direction: column; gap: 12px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent-mid); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 30px; text-align: center; }
.empty-icon { font-size: 40px; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; }
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.1px; }
.empty-sub { font-size: 13px; color: var(--ink-muted); line-height: 1.6; }
.toast { position: absolute; bottom: calc(var(--bottom) + 14px); left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; z-index: 99; opacity: 0; transition: all 0.25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.error-msg { font-size: 12px; color: var(--red); padding: 3px 0; min-height: 18px; }

/* ── TRIP COMPLETION BANNERS ── */
.completion-banner { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: var(--r-sm); padding: 13px 14px; margin: 0 16px 10px; display: flex; align-items: flex-start; gap: 11px; animation: fadeUp 0.25s ease both; }
.completion-banner.pending-rating { border-left-color: var(--amber); }
.banner-emoji { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.banner-content { flex: 1; }
.banner-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.banner-sub { font-size: 12px; color: var(--ink-muted); line-height: 1.4; margin-bottom: 9px; }
.banner-btns { display: flex; gap: 7px; }
.banner-btn { height: 28px; padding: 0 12px; border-radius: var(--r-sm); font-family: var(--font-body); font-size: 11px; font-weight: 500; cursor: pointer; border: 1px solid; transition: all 0.15s; letter-spacing: 0.2px; }
.banner-btn.yes { background: var(--green); color: #fff; border-color: var(--green); }
.banner-btn.no { background: var(--bg); color: var(--ink-muted); border-color: var(--border); }
.banner-btn.rate { background: var(--amber); color: #fff; border-color: var(--amber); }
.banner-btn:active { transform: scale(0.94); }

/* ── RATING MODAL ── */
.rating-overlay { position: absolute; inset: 0; z-index: 80; background: rgba(24,24,27,0.55); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 20px; }
.rating-overlay.open { display: flex; }
.rating-modal { background: var(--surface); border-radius: var(--r); padding: 24px 22px; width: 100%; max-width: 360px; text-align: center; animation: popIn 0.28s cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes popIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rating-av { width: 56px; height: 56px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-family: var(--font-body); font-size: 18px; font-weight: 600; color: #fff; margin: 0 auto 12px; }
.rating-title { font-family: var(--font-display); font-size: 18px; font-weight: 400; color: var(--ink); margin-bottom: 5px; }
.rating-sub { font-size: 12px; font-weight: 300; color: var(--ink-muted); line-height: 1.5; margin-bottom: 16px; }
.rating-route-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-light); color: var(--accent); font-size: 11px; font-weight: 500; padding: 4px 12px; border-radius: 4px; margin-bottom: 18px; letter-spacing: 0.2px; }
.stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.star { font-size: 32px; cursor: pointer; transition: transform 0.12s, opacity 0.12s; opacity: 0.25; user-select: none; }
.star.active { opacity: 1; transform: scale(1.08); }
.star:hover { opacity: 1; }
.rating-note { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--font-body); font-size: 13px; color: var(--ink); outline: none; resize: none; min-height: 56px; line-height: 1.5; margin-bottom: 14px; transition: border-color 0.2s; }
.rating-note:focus { border-color: var(--accent-mid); }
.rating-submit-btn { width: 100%; height: 42px; background: var(--accent); color: #fff; border: none; border-radius: var(--r-sm); font-family: var(--font-body); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; letter-spacing: 0.2px; }
.rating-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rating-submit-btn:not(:disabled):hover { background: var(--accent-dark); }
.rating-submit-btn:not(:disabled):active { transform: scale(0.97); }
.rating-skip { font-size: 12px; color: var(--ink-muted); cursor: pointer; margin-top: 10px; display: block; }
.rating-skip:hover { color: var(--ink-mid); }

/* Completed route states */
.my-route-card.completed { opacity: 0.65; }
.status-pill.completed { background: var(--bg); color: var(--ink-muted); border: 1px solid var(--border); }
.status-pill.pending { background: var(--amber-light); color: var(--amber); }

