/* ═══════════════════════════════════════════════════════════
   AR Wayfinding — ar.css
   Depends on: ../styles.css (shared vars, nav, page-hero, btns)
═══════════════════════════════════════════════════════════ */

/* ── Screen system ───────────────────────────────────────── */
.ar-screen          { display: none; min-height: 100vh; }
.ar-screen.is-active { display: block; }
.ar-fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  background: #000; overflow: hidden;
  min-height: unset;
}

/* ── Hero extras ─────────────────────────────────────────── */
.hero-capabilities {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px;
}
.cap-chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.85);
  font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 100px;
}

/* ── GPS status card ─────────────────────────────────────── */
.list-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 32px;
}
.gps-status-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 100px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  white-space: nowrap; box-shadow: var(--shadow);
}
.gps-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gray-400);
  display: inline-block;
  transition: background 0.4s;
}
.gps-pulse.good   { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.5); animation: gpsBlink 2s infinite; }
.gps-pulse.fair   { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.gps-pulse.weak   { background: #ef4444; }
@keyframes gpsBlink { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ── Filters ─────────────────────────────────────────────── */
.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px;
}
.ar-chip {
  padding: 7px 16px; border-radius: 100px;
  border: 1.5px solid var(--gray-200);
  background: var(--white); color: var(--gray-700);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.ar-chip:hover    { border-color: var(--blue); color: var(--blue); }
.ar-chip.is-active {
  background: var(--blue); border-color: var(--blue);
  color: var(--white);
}

/* ── Route Grid ──────────────────────────────────────────── */
.route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Route Card ──────────────────────────────────────────── */
.route-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer;
  transition: transform 0.22s, box-shadow 0.22s;
  text-decoration: none; color: inherit; display: block;
}
.route-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.route-card-stripe { height: 5px; }
.stripe-accessible { background: linear-gradient(90deg, #22c55e, #16a34a); }
.stripe-partial    { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stripe-limited    { background: linear-gradient(90deg, #ef4444, #dc2626); }

.route-card-body { padding: 22px 24px 20px; }

.route-card-top {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px; margin-bottom: 6px;
}
.route-name {
  font-family: var(--font-display); font-size: 17px;
  font-weight: 700; color: var(--gray-900); line-height: 1.2;
}
.a11y-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 100px; white-space: nowrap; flex-shrink: 0;
}
.pill-accessible { background: #dcfce7; color: #15803d; }
.pill-partial    { background: #fef3c7; color: #92400e; }
.pill-limited    { background: #fee2e2; color: #991b1b; }

.route-desc {
  font-size: 13.5px; color: var(--gray-400); line-height: 1.55;
  margin-bottom: 14px;
}

.route-meta-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--gray-700); font-weight: 500;
  margin-bottom: 14px;
}

/* Lighting bar */
.lighting-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.lighting-track {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--gray-200); overflow: hidden;
}
.lighting-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }
.light-excellent .lighting-fill { background: #22c55e; width: 100%; }
.light-good      .lighting-fill { background: #84cc16; width: 80%;  }
.light-fair      .lighting-fill { background: #f59e0b; width: 55%;  }
.light-poor      .lighting-fill { background: #ef4444; width: 25%;  }
.lighting-label { font-size: 12px; color: var(--gray-400); white-space: nowrap; }

/* Tags & obstacle chips */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.route-tag {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 100px; background: #eff6ff; color: var(--blue);
}
.obs-tag {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 100px; background: #fffbeb; color: #92400e;
}

/* ── Detail Screen ───────────────────────────────────────── */
.detail-topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 28px;
}
.detail-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--blue); padding: 6px 0;
}
.detail-back-btn:hover { opacity: 0.75; }

.detail-scroll { padding: 32px 40px 120px; max-width: 760px; margin: 0 auto; }

.detail-hero-name {
  font-family: var(--font-display); font-size: clamp(28px,4vw,44px);
  font-weight: 800; color: var(--gray-900); line-height: 1.1;
  letter-spacing: -0.02em; margin-bottom: 12px;
}
.detail-meta-row {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 14px; color: var(--gray-700); font-weight: 500; margin-bottom: 20px;
}
.detail-desc {
  font-size: 16px; color: var(--gray-400); line-height: 1.65;
  margin-bottom: 28px;
}

.a11y-summary {
  background: #f0f9ff; border: 1px solid #bae6fd;
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 28px;
}
.a11y-summary-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--blue); margin-bottom: 14px;
}
.a11y-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px;
}
.a11y-item { font-size: 13.5px; color: var(--gray-700); display: flex; align-items: center; gap: 6px; }

/* Timeline */
.timeline-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  color: var(--gray-900); margin-bottom: 20px;
}
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  display: flex; gap: 16px; position: relative; padding-bottom: 24px;
}
.tl-item:not(:last-child) .tl-line {
  position: absolute; left: 19px; top: 42px; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.tl-dot {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); border: 3px solid #e0eeff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; position: relative; z-index: 1;
}
.tl-dot.tl-dot-warn { background: #f59e0b; border-color: #fef3c7; }
.tl-dot.tl-dot-last { background: #22c55e; border-color: #dcfce7; }
.tl-content { flex: 1; padding-top: 4px; }
.tl-name { font-weight: 700; font-size: 15px; color: var(--gray-900); }
.tl-instr { font-size: 13.5px; color: var(--gray-400); margin: 3px 0; line-height: 1.5; }
.tl-a11y { font-size: 12.5px; color: #16a34a; margin-top: 4px; }
.tl-obs {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 100px;
  background: #fffbeb; color: #92400e; margin-top: 4px;
}

.detail-action-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(20px);
  border-top: 1px solid var(--gray-200);
  padding: 16px 24px; display: flex; gap: 12px; align-items: center;
}
.detail-btn-ar {
  flex: 1; justify-content: center; font-size: 16px;
  padding: 15px 24px;
}
.btn-detail-text {
  background: transparent; border: 1.5px solid var(--gray-200);
  color: var(--gray-700); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; padding: 14px 18px;
  border-radius: 100px; cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
}
.btn-detail-text:hover { border-color: var(--blue); color: var(--blue); }

/* ── Navigation Screen ───────────────────────────────────── */
#ar-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  display: none;
}
#ar-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; display: none;
}

/* Compass fallback */
.compass-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, #0d1b3e 0%, #020a1a 100%);
  display: flex; align-items: center; justify-content: center;
}
.compass-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }

.compass-ring {
  width: 240px; height: 240px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  background: radial-gradient(circle at 50% 50%,
    rgba(0,83,159,0.25) 0%, rgba(0,83,159,0.05) 60%, transparent 100%);
  box-shadow: 0 0 60px rgba(0,83,159,0.35), inset 0 0 40px rgba(0,83,159,0.1);
  position: relative; display: flex; align-items: center; justify-content: center;
  transition: transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
}
.compass-needle-wrap {
  position: absolute;
  width: 4px; height: 100%;
  left: calc(50% - 2px); top: 0;
  transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
}
.compass-needle-north {
  position: absolute; top: 12px;
  width: 4px; height: 90px;
  background: linear-gradient(to bottom, var(--gold), rgba(255,210,0,0.4));
  border-radius: 2px; left: 0;
}
.compass-needle-south {
  position: absolute; bottom: 12px;
  width: 4px; height: 90px;
  background: linear-gradient(to top, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
  border-radius: 2px; left: 0;
}
.compass-card {
  position: absolute; font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.5); font-family: var(--font-display);
}
.c-n { top: 8px; left: 50%; transform: translateX(-50%); color: var(--gold); }
.c-e { right: 10px; top: 50%; transform: translateY(-50%); }
.c-s { bottom: 8px; left: 50%; transform: translateX(-50%); }
.c-w { left: 10px; top: 50%; transform: translateY(-50%); }

.compass-label {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--white); text-align: center;
}
.compass-bearing-label {
  font-size: 13px; color: rgba(255,255,255,0.45); text-align: center; margin-top: -10px;
}

/* ── AR Top Banner ───────────────────────────────────────── */
.nav-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: 16px 16px 0;
  display: flex; align-items: flex-start; gap: 10px;
}
.instr-card {
  flex: 1; display: flex; align-items: center; gap: 14px;
  background: rgba(5,5,20,0.78); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px; padding: 14px 18px; color: var(--white);
}
.instr-icon { font-size: 1.9rem; line-height: 1; flex-shrink: 0; }
.instr-primary { font-size: 15px; font-weight: 700; line-height: 1.35; }
.instr-secondary {
  font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 3px;
}
.gps-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(5,5,20,0.7); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 100px;
  padding: 7px 12px; font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.7); white-space: nowrap;
}
.gps-dot-sm {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gray-400); display: inline-block;
  transition: background 0.4s;
}
.gps-dot-sm.good { background: #22c55e; animation: gpsBlink 2s infinite; }
.gps-dot-sm.fair { background: #f59e0b; }
.gps-dot-sm.weak { background: #ef4444; }

/* ── AR Bottom Controls ──────────────────────────────────── */
.nav-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: 0 16px 28px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
}
.wp-dots {
  display: flex; justify-content: center; gap: 8px; margin-bottom: 16px;
}
.wp-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.25); transition: all 0.35s;
}
.wp-dot.done    { background: #22c55e; }
.wp-dot.current {
  background: var(--gold); transform: scale(1.4);
  box-shadow: 0 0 10px rgba(255,210,0,0.7);
  animation: wpdotPulse 1.4s ease infinite;
}
@keyframes wpdotPulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }

.nav-ctrl-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.nav-btn {
  background: rgba(255,255,255,0.12); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 100px;
  color: var(--white); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; padding: 11px 20px;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.nav-btn:hover { background: rgba(255,255,255,0.22); }
.nav-btn-exit {
  background: rgba(220,38,38,0.55); border-color: rgba(220,38,38,0.7);
  padding: 11px 28px;
}
.nav-btn-exit:hover { background: rgba(220,38,38,0.75); }
.nav-btn.muted { opacity: 0.45; }

/* ── Obstacle Banner ─────────────────────────────────────── */
.obstacle-banner {
  position: absolute; bottom: 120px; left: 50%; z-index: 11;
  transform: translateX(-50%);
  background: rgba(245,158,11,0.92); backdrop-filter: blur(8px);
  border-radius: 100px; padding: 10px 22px;
  font-size: 14px; font-weight: 700; color: var(--white);
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(245,158,11,0.4);
  animation: bannerSlideUp 0.3s ease;
  white-space: nowrap;
}
@keyframes bannerSlideUp {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ── Arrival Overlay ─────────────────────────────────────── */
.arrival-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.arrival-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 40px 32px; text-align: center;
  max-width: 340px; width: 90%;
  animation: cardPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cardPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.arrival-emoji { font-size: 52px; margin-bottom: 12px; }
.arrival-title {
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  color: var(--gray-900); margin-bottom: 8px;
}
.arrival-sub { font-size: 15px; color: var(--gray-400); margin-bottom: 16px; line-height: 1.5; }
.arrival-stats {
  display: flex; justify-content: center; gap: 24px;
  margin-bottom: 24px; padding: 14px 0;
  border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200);
}
.arrival-stat { display: flex; flex-direction: column; gap: 2px; }
.arrival-stat-val { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--blue); }
.arrival-stat-lbl { font-size: 11px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }

/* ── Permission overlay ──────────────────────────────────── */
.perm-overlay {
  position: absolute; inset: 0; z-index: 25;
  background: rgba(0,0,0,0.9); display: flex;
  align-items: center; justify-content: center;
}
.perm-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 36px 28px; text-align: center;
  max-width: 320px; width: 88%;
}
.perm-icon { font-size: 44px; margin-bottom: 12px; }
.perm-card h3 {
  font-family: var(--font-display); font-size: 20px; font-weight: 800;
  color: var(--gray-900); margin-bottom: 10px;
}
.perm-card p { font-size: 14px; color: var(--gray-400); line-height: 1.6; margin-bottom: 20px; }
.btn-skip-perm {
  display: block; margin-top: 12px; background: none; border: none;
  font-size: 13px; color: var(--gray-400); cursor: pointer;
  font-family: var(--font-body); text-decoration: underline;
}

/* ── Map modal overlay ───────────────────────────────────── */
.map-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.map-modal-overlay.is-open {
  display: flex;
}

.map-modal {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: mapModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mapModalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.map-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  flex-shrink: 0;
}
.map-modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}
.map-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-modal-fit-btn {
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.map-modal-fit-btn:hover { opacity: 0.85; }
.map-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.map-modal-close:hover {
  background: var(--gray-100, #f3f4f6);
  border-color: var(--gray-300, #d1d5db);
}

/* Map container inside the modal — needs a concrete height */
.map-modal-body {
  width: 100%;
  height: 420px;
  position: relative;
  background: #e5e7eb;
}
.map-modal-body .mapboxgl-canvas { display: block; }

.map-modal-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  flex-shrink: 0;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-done    { background: #22c55e; }
.legend-current { background: #FFD200; }
.legend-pending { background: #00539F; }

/* ── Tab bar ──────────────────────────────────────────────── */
.nav-tab-bar {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}
.nav-tab-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 14px;
  border-radius: 100px;
  color: rgba(255,255,255,0.38);
  border: 1px solid rgba(255,255,255,0.10);
  cursor: default;
  transition: all 0.22s;
}
.nav-tab-pill.is-active {
  color: var(--white);
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.30);
}

/* ── Tab-cycle button ─────────────────────────────────────── */
.nav-btn-tab {
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  padding: 8px 18px;
  letter-spacing: -1px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .route-grid       { grid-template-columns: 1fr; }
  .a11y-grid        { grid-template-columns: 1fr; }
  .detail-scroll    { padding: 24px 20px 120px; }
  .detail-action-bar { padding: 12px 16px; }
  .detail-btn-ar    { font-size: 14px; padding: 13px 20px; }
  section           { padding: 48px 20px 64px; }
  .list-header      { flex-direction: column; align-items: flex-start; }
  .map-modal-overlay { padding: 12px; }
  .map-modal         { max-height: 90vh; }
  .map-modal-body    { height: 350px; }
}

@media (max-width: 400px) {
  .nav-ctrl-row { gap: 8px; }
  .nav-btn      { font-size: 13px; padding: 10px 14px; }
  .nav-btn-exit { padding: 10px 20px; }
}
