/* Auspicious Route specific */

.step-card {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
}
.step-label {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 14px;
}
.step-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.step-label-row .step-label { margin-bottom: 0; }
.pro-badge {
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 500;
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 11px; color: var(--text-tertiary); margin-bottom: 6px; letter-spacing: 0.5px; }
.link-btn {
  font-size: 11px;
  color: var(--accent-gold);
  margin-top: 6px;
  display: inline-block;
  background: none;
  padding: 0;
  cursor: pointer;
}
.link-btn:hover { opacity: 0.7; }

.time-input-group { display: flex; gap: 8px; }
.time-input-group .input { flex: 1; }
.time-now-btn {
  background: var(--neutral-bg);
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.time-now-btn:hover { background: var(--gold-50); color: var(--gold-900); }

.purpose-grid-route {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.purpose-btn-route {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}
.purpose-btn-route:hover { border-color: var(--accent-gold); color: var(--text-dark); }
.purpose-btn-route.active {
  background: var(--hero-gradient);
  border: 1px solid var(--accent-gold);
  color: var(--gold-900);
}
.purpose-btn-route .icon { display: block; font-size: 16px; margin-bottom: 4px; }

.team-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.team-member {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-row { display: flex; align-items: center; gap: 8px; }
.team-member-name { font-size: 13px; font-weight: 500; color: var(--text-dark); }
.team-member-tag { font-size: 10px; color: var(--text-tertiary); }
.team-member-meta { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.team-driver-toggle {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--neutral-bg);
  color: var(--text-muted);
  cursor: pointer;
}
.team-driver-toggle.active { background: var(--gold-50); color: var(--gold-900); }
.team-remove {
  font-size: 18px;
  color: var(--text-tertiary);
  padding: 4px 8px;
  cursor: pointer;
}

.add-member-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.add-member-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

.cta-button {
  width: 100%;
  background: var(--cta-gradient);
  color: var(--gold-50);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 16px;
  margin-bottom: 24px;
  transition: all 0.2s ease;
  font-family: var(--font-serif);
}
.cta-button:active { transform: scale(0.98); }
.cta-button .cta-sub { font-size: 10px; color: var(--gold-200); letter-spacing: 1px; }

/* Result Phase */
.verdict-card {
  background: var(--hero-gradient);
  border-radius: var(--radius-xl);
  padding: 28px 20px;
  margin-bottom: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.verdict-card.verdict-bad { background: linear-gradient(135deg, rgba(184, 90, 90, 0.15), rgba(115, 34, 22, 0.15)); }
.verdict-card.verdict-ok { background: linear-gradient(135deg, var(--success-bg), rgba(74, 124, 74, 0.18)); }

.verdict-loading { padding: 12px 0; }
.verdict-meta { font-size: 10px; letter-spacing: 3px; color: var(--text-tertiary); text-transform: uppercase; font-weight: 500; }
.verdict-text {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.2;
  margin-top: 8px;
}
.verdict-card.verdict-bad .verdict-text { color: var(--warning); }
.verdict-card.verdict-ok .verdict-text { color: var(--success); }

.verdict-score-row { margin-top: 12px; }
.verdict-score { font-family: var(--font-serif); font-size: 36px; font-weight: 500; color: var(--text-dark); }
.verdict-score-suffix { font-size: 13px; color: var(--text-tertiary); }

.verdict-team-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  background: rgba(74, 124, 74, 0.15);
  border-radius: 12px;
  font-size: 11px;
  color: var(--success);
}

.result-card {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.timing-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.timing-item { text-align: center; }
.timing-divider { border-left: 0.5px solid var(--border-light); border-right: 0.5px solid var(--border-light); }
.timing-value { font-family: var(--font-serif); font-size: 22px; font-weight: 500; color: var(--text-dark); }
.timing-label { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }

.distance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.distance-item { display: flex; justify-content: space-between; padding: 4px 0; }
.distance-key { font-size: 12px; color: var(--text-muted); }
.distance-val { font-size: 12px; color: var(--text-dark); font-weight: 500; }

.team-result-list { display: flex; flex-direction: column; }
.team-result-item { padding: 10px 0; border-bottom: 0.5px solid var(--border-light); }
.team-result-item:last-child { border-bottom: none; }
.team-result-row { display: flex; justify-content: space-between; align-items: center; }
.team-result-name { font-size: 13px; font-weight: 500; color: var(--text-dark); }
.team-result-meta { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.team-result-tags { display: flex; gap: 6px; align-items: center; }
.team-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--neutral-bg);
  color: var(--text-muted);
}
.team-tag.tag-primary { background: rgba(184, 148, 31, 0.15); color: var(--gold-700); }
.team-tag.tag-good { background: rgba(74, 124, 74, 0.15); color: var(--success); }
.team-check { color: var(--success); font-size: 14px; }

.summary-card {
  background: linear-gradient(135deg, rgba(184, 148, 31, 0.08), rgba(74, 124, 74, 0.08));
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.summary-text { font-size: 13px; line-height: 1.7; color: var(--text-dark); }
.summary-text strong { font-weight: 500; }

.smart-hint-box {
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.6;
}
.smart-hint-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: var(--cta-gradient);
  color: var(--gold-50);
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
}

.time-slider-row {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.time-slider-row::-webkit-scrollbar { height: 4px; }
.time-slider-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.time-chip {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 0.5px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
  min-width: 56px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.time-chip:hover { background: var(--gold-50); }
.time-chip.active {
  background: var(--hero-gradient);
  border-color: var(--accent-gold);
}
.time-chip-time { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.time-chip-score { font-size: 13px; font-weight: 500; color: var(--text-dark); }
.time-chip.tier-da_ji { background: rgba(184, 148, 31, 0.15); }
.time-chip.tier-da_ji .time-chip-score { color: var(--accent-gold); }
.time-chip.tier-ji { background: rgba(74, 124, 74, 0.12); }
.time-chip.tier-ji .time-chip-score { color: var(--success); }
.time-chip.tier-xiong { background: rgba(184, 90, 90, 0.08); }
.time-chip.tier-xiong .time-chip-score { color: var(--warning); }
.time-chip.tier-da_xiong { background: rgba(115, 34, 22, 0.12); }
.time-chip.tier-da_xiong .time-chip-score { color: var(--danger); }

.leaflet-container-mini {
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 0.5px solid var(--border-light);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-top: 16px;
}
.result-actions .btn-primary { padding: 13px; }
.result-actions .btn-secondary { padding: 13px 16px; }

@media (max-width: 480px) {
  .verdict-text { font-size: 22px; }
  .verdict-score { font-size: 30px; }
  .timing-value { font-size: 18px; }
  .leaflet-container-mini { height: 240px; }
}

/* ============================================================
   V2 ADDITIONS — Annual Hint Chip + Top Version + Tab Disabled
   ============================================================ */

/* Top bar V2 badge */
.top-version {
  margin-left: 8px;
  padding: 1px 6px;
  background: var(--accent-gold);
  color: var(--bg);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Annual chip in verdict card */
.annual-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.annual-chip-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning);
}
.annual-chip-good {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}
.annual-chip-neutral {
  background: var(--neutral-bg);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Disabled tab */
.tab-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Page meta with V2 hint */
.page-title-block {
  margin-bottom: 20px;
}
.page-meta {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.2;
  margin: 0;
}

/* Common form input for V2 */
.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 0.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

/* Buttons V2 */
.btn-primary {
  background: var(--cta-gradient, var(--accent-gold));
  color: var(--bg, var(--gold-50));
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 0.5px solid var(--border-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  border-color: var(--accent-gold);
  color: var(--text-dark);
}

/* ============== Loading Overlay (rt-loading-overlay) ============== */
.rt-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,8,22,0.85);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-size: 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.rt-loading-overlay[hidden] { display: none; }
.rt-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(200,164,92,0.2);
  border-top-color: #c8a45c;
  border-radius: 50%;
  animation: rt-spin 0.8s linear infinite;
}
.rt-loading-msg {
  font-size: 13px;
  color: #c8a45c;
  letter-spacing: 0.5px;
}
.rt-loading-sub {
  font-size: 11px;
  color: #94a3b8;
}
@keyframes rt-spin { to { transform: rotate(360deg); } }

/* === Mini Chart in 5 ฤกษ์ panel (redesign by dev · 1 พ.ค.) === */
.rt-mini-chart {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 360px;
  margin: 0 auto;
}
.rt-mini-cell {
  position: relative;
  padding: 8px 4px 11px;
  border-radius: 6px;
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
  transition: outline 0.15s;
}
.rt-mini-cell.empty {
  background: transparent;
  border: 1px dashed rgba(148,163,184,0.2);
}
.rt-mini-dir {
  font-size: 10px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rt-mini-door {
  font-size: 22px;
  font-family: 'Noto Serif TC', 'Songti TC', serif;
  font-weight: 500;
  line-height: 1;
  margin: 4px 0 3px;
  color: #cbd5e1;
}
.rt-mini-score {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* score bar ที่ขอบล่าง */
.rt-mini-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 0 0 6px 6px;
}
/* tier backgrounds + bar colors */
.rt-mini-cell.t-l1 { background: #0a2018; }
.rt-mini-cell.t-l1 .rt-mini-bar { background: #22c55e; }
.rt-mini-cell.t-l2 { background: #0c2a45; }
.rt-mini-cell.t-l2 .rt-mini-bar { background: #38bdf8; }
.rt-mini-cell.t-l3 { background: #1a1408; }
.rt-mini-cell.t-l3 .rt-mini-bar { background: #facc15; }
.rt-mini-cell.t-l4 { background: #1a0f08; }
.rt-mini-cell.t-l4 .rt-mini-bar { background: #fb923c; }
.rt-mini-cell.t-l5 { background: #2a0f0f; }
.rt-mini-cell.t-l5 .rt-mini-bar { background: #f87171; }
.rt-mini-cell.t-l6 { background: #2a0a0a; }
.rt-mini-cell.t-l6 .rt-mini-bar { background: #991b1b; }
/* วังที่เส้นทางผ่าน */
.rt-mini-cell.is-passed {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.rt-mini-cell.is-passed.t-l1 { color: #22c55e; }
.rt-mini-cell.is-passed.t-l2 { color: #38bdf8; }
.rt-mini-cell.is-passed.t-l3 { color: #facc15; }
.rt-mini-cell.is-passed.t-l4 { color: #fb923c; }
.rt-mini-cell.is-passed.t-l5 { color: #f87171; }
.rt-mini-cell.is-passed.t-l6 { color: #991b1b; }
.rt-mini-cell.is-passed .rt-mini-dir { font-weight: 500; opacity: 0.85; }
.rt-mini-cell.is-passed .rt-mini-door { color: #bae6fd; }
/* วังกลาง 中宮 */
.rt-mini-cell.is-center { opacity: 0.65; }
/* legend strip ใต้ผัง */
.rt-mini-legend {
  display: flex;
  gap: 4px;
  max-width: 360px;
  margin: 8px auto 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.rt-mini-legend-item {
  flex: 1;
  text-align: center;
  padding: 4px 2px;
  border-radius: 4px;
  color: #0a0e1a;
}
.rt-mini-legend-item.l1 { background: #22c55e; }
.rt-mini-legend-item.l2 { background: #38bdf8; }
.rt-mini-legend-item.l3 { background: #facc15; }
.rt-mini-legend-item.l4 { background: #fb923c; }
.rt-mini-legend-item.l5 { background: #f87171; }
.rt-mini-legend-item.l6 { background: #991b1b; color: #fff; }
.rt-bt-wrap {
  transition: border-color 0.15s;
}
.rt-bt-wrap:hover {
  border-color: rgba(200,164,92,0.5);
}

/* === Route page padding + map height (1 พ.ค.) === */
.route-page {
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
/* map element จริงใช้ id="leafletMap" + class="rt-map" */
#leafletMap, .rt-map, #routeMap {
  height: min(42vh, 360px) !important;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 12px;
}
/* กัน leaflet container ล้นกรอบ */
.leaflet-container {
  max-width: 100%;
  border-radius: 12px;
}
