/* ============================================================
   TIER 4 FEATURES CSS — First Out App
   Features: Event Mode, Walk-It-Instead, Journey Planner (Enhanced),
             Interchange Walk Times, Toilet Finder

   Integration:
     1. Add <link rel="stylesheet" href="/tier4-features.css"> to <head>
     2. Add <script src="/tier4-features.js" defer></script> before </body>
     3. The JS will inject HTML as needed — no manual HTML insertion required.
     4. CSS variables from the main app (--bg, --accent, etc.) are used.
   ============================================================ */


/* ============================================================
   6. EVENT MODE
   Banner shown on event-adjacent stations with pre/post tips.
   ============================================================ */

.event-mode-banner {
  margin: 12px 0;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 171, 0, 0.3);
  background: linear-gradient(135deg, rgba(255, 171, 0, 0.08) 0%, rgba(255, 86, 48, 0.06) 100%);
  overflow: hidden;
  animation: eventBannerIn 0.3s ease-out;
}

@keyframes eventBannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.event-banner-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.event-banner-header:active {
  background: rgba(255, 171, 0, 0.1);
}

.event-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.event-banner-title {
  flex: 1;
  min-width: 0;
}

.event-banner-venue {
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 2px;
}

.event-banner-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.event-banner-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.event-mode-banner.expanded .event-banner-chevron {
  transform: rotate(180deg);
}

.event-banner-body {
  display: none;
  padding: 0 16px 16px;
}

.event-mode-banner.expanded .event-banner-body {
  display: block;
}

.event-tip-section {
  margin-bottom: 12px;
}

.event-tip-section:last-child {
  margin-bottom: 0;
}

.event-tip-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.event-tip-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--amber);
}

.event-tip-text.post-event {
  border-left-color: var(--red);
}

.event-tip-general {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.4;
}


/* ============================================================
   7. WALK-IT-INSTEAD
   Suggestion shown on result screen when walking is competitive.
   ============================================================ */

.walk-suggestion {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(54, 179, 126, 0.1) 0%, rgba(76, 154, 255, 0.06) 100%);
  border: 1px solid rgba(54, 179, 126, 0.25);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: walkSuggestIn 0.35s ease-out;
}

@keyframes walkSuggestIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.walk-suggestion-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.walk-suggestion-content {
  flex: 1;
  min-width: 0;
}

.walk-suggestion-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.walk-suggestion-detail {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.walk-suggestion-distance {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.walk-suggestion-direction {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}


/* ============================================================
   8. JOURNEY PLANNER (ENHANCED)
   Enhanced journey results with interchange steps and graph.
   Injected into the existing #journeyResult container.
   ============================================================ */

.journey-enhanced-card {
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 16px;
}

.journey-enhanced-header {
  padding: 16px;
  background: rgba(76, 154, 255, 0.06);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.journey-enhanced-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.journey-enhanced-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.journey-step {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.journey-step:last-child {
  border-bottom: none;
}

.journey-step-number {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.journey-step-content {
  padding-left: 36px;
}

.journey-step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.journey-step-station {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.journey-step-line-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.journey-step-position {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.journey-step-exit {
  font-size: 13px;
  color: var(--text-secondary);
}

.journey-step-tip {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 6px;
}

.journey-step-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.journey-connector-icon {
  font-size: 16px;
}

.journey-connector-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.journey-walk-tip {
  margin: 12px 16px 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(54, 179, 126, 0.08);
  border: 1px solid rgba(54, 179, 126, 0.2);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.journey-walk-tip strong {
  color: var(--green);
}

/* No route found */
.journey-no-route {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.journey-no-route-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.journey-no-route-text {
  font-size: 14px;
  line-height: 1.5;
}


/* ============================================================
   9. INTERCHANGE WALK TIMES
   Shown on exit picker screen for multi-line stations.
   ============================================================ */

.interchange-times-section {
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
}

.interchange-times-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.interchange-times-header:active {
  background: var(--bg-card-hover);
}

.interchange-times-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.interchange-times-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.interchange-times-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.interchange-times-section.expanded .interchange-times-chevron {
  transform: rotate(180deg);
}

.interchange-times-body {
  display: none;
  padding: 0 16px 16px;
}

.interchange-times-section.expanded .interchange-times-body {
  display: block;
}

.interchange-time-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.interchange-time-row:last-child {
  border-bottom: none;
}

.interchange-time-lines {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.interchange-time-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.interchange-time-arrow {
  font-size: 11px;
  color: var(--text-muted);
}

.interchange-time-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.interchange-time-duration {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.interchange-time-duration.fast {
  color: var(--green);
}

.interchange-time-duration.moderate {
  color: var(--amber);
}

.interchange-time-duration.slow {
  color: var(--red);
}


/* ============================================================
   10. TOILET FINDER
   Toggle on home screen + toilet info on result/exit screens.
   ============================================================ */

.toilet-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.toilet-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s;
}

.toilet-toggle-btn:active {
  transform: scale(0.97);
}

.toilet-toggle-btn.active {
  background: rgba(76, 154, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.toilet-toggle-icon {
  font-size: 15px;
}

/* Toilet info card on result screen */
.toilet-info-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toilet-info-card.available {
  border-color: rgba(54, 179, 126, 0.3);
  background: linear-gradient(135deg, rgba(54, 179, 126, 0.06) 0%, rgba(54, 179, 126, 0.02) 100%);
}

.toilet-info-card.unavailable {
  border-color: rgba(255, 86, 48, 0.2);
  background: linear-gradient(135deg, rgba(255, 86, 48, 0.04) 0%, transparent 100%);
}

.toilet-info-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.toilet-info-content {
  flex: 1;
  min-width: 0;
}

.toilet-info-status {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.toilet-info-status.yes {
  color: var(--green);
}

.toilet-info-status.no {
  color: var(--red);
}

.toilet-info-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toilet-info-nearest {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.toilet-info-tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.toilet-info-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.toilet-info-tag.accessible {
  background: rgba(76, 154, 255, 0.12);
  color: var(--accent);
}

/* Toilet marker on station list */
.station-toilet-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(54, 179, 126, 0.12);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  flex-shrink: 0;
}
