/* IIT Tirupati — 7-screen navigation flow */

:root {
  --bg: #07141a;
  --bg-2: #0d222c;
  --card: #12303b;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3fafc;
  --muted: #9bb4be;
  --cyan: #3ec6e0;
  --teal: #2dd4a8;
  --rose: #fb7185;
  --ink: #041016;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Outfit", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body { overflow: hidden; }

h1, h2, h3 { font-family: var(--display); font-weight: 750; letter-spacing: -0.02em; }

.flow-app {
  height: 100%;
  position: relative;
}

.flow-screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: auto;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(62, 198, 224, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(45, 212, 168, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

.flow-screen.is-active {
  display: flex;
}

.flow-screen[hidden] { display: none !important; }

.flow-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 20, 26, 0.2), rgba(7, 20, 26, 0.85)),
    url("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/16/25890/45840") center/cover;
  opacity: 0.35;
  pointer-events: none;
}

.flow-shell {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.home-shell {
  justify-content: center;
  min-height: 100%;
  padding-top: 48px;
}

.home-brand { text-align: left; }

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--ink);
  font-size: 1.4rem;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.brand-kicker, .top-kicker {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.home-brand h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.05;
  margin-bottom: 12px;
}

.home-lead, .flow-copy {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.98rem;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.home-steps {
  list-style: none;
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.home-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-steps span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(62, 198, 224, 0.15);
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.8rem;
}

.flow-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(7, 20, 26, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.flow-topbar h2 { font-size: 1.15rem; }

.icon-back {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.icon-back.dark {
  background: rgba(7, 20, 26, 0.75);
}

.flow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  cursor: pointer;
}

.flow-btn.primary {
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--ink);
  border: none;
  box-shadow: 0 10px 24px rgba(62, 198, 224, 0.28);
}

.flow-btn.ghost { background: transparent; }
.flow-btn.lg { padding: 16px 20px; font-size: 1rem; width: 100%; }

.choice-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(18, 48, 59, 0.7);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.choice-card strong { display: block; margin-bottom: 4px; }
.choice-card span { color: var(--muted); font-size: 0.88rem; }

.choice-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--ink);
}

.choice-icon.alt { background: linear-gradient(135deg, #38bdf8, #818cf8); color: #fff; }
.choice-icon.soft { background: rgba(255, 255, 255, 0.08); color: var(--cyan); }

.status-line {
  color: var(--cyan);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.list-shell { padding-bottom: 28px; }

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.search-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.building-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.building-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(18, 48, 59, 0.55);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}

.building-item:hover { border-color: rgba(62, 198, 224, 0.45); }

.building-item i {
  margin-top: 2px;
  color: var(--cyan);
}

.building-item strong { display: block; margin-bottom: 2px; }
.building-item small { color: var(--muted); }

.confirm-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(18, 48, 59, 0.85);
  border: 1px solid rgba(62, 198, 224, 0.25);
  box-shadow: var(--shadow);
}

.confirm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.confirm-card h3 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag-row span {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(62, 198, 224, 0.12);
  color: var(--cyan);
}

.from-chip {
  color: var(--muted);
  font-size: 0.9rem;
}

.from-chip strong { color: var(--teal); }

.cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.cat-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.cat-pill.active {
  background: rgba(62, 198, 224, 0.18);
  color: var(--cyan);
  border-color: rgba(62, 198, 224, 0.4);
}

/* Map stage */
.map-screen {
  background: #000;
  overflow: hidden;
}

.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-chrome {
  position: absolute;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.map-chrome[hidden],
.arrived-sheet[hidden] {
  display: none !important;
}

.map-chrome > * { pointer-events: auto; }

.map-top-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 0;
}

.map-top-text {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(7, 20, 26, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
}

.map-top-text h2 { font-size: 1rem; }

.preview-sheet {
  margin: 0 12px 16px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(7, 20, 26, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-stats > div {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.preview-stats strong { color: var(--text); }

.preview-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.preview-hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}

.map-filters {
  position: absolute;
  top: 72px;
  right: 12px;
  z-index: 450;
  width: min(190px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 16px;
  background: rgba(7, 20, 26, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.map-filters-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 2px;
}

.map-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.map-filter-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.map-filter-item span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-filter-item i { color: var(--cyan); width: 16px; text-align: center; }

.campus-poi-marker { background: transparent !important; border: none !important; }

.campus-poi-dot {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(7, 20, 26, 0.92);
  border: 1.5px solid var(--poi, #3ec6e0);
  color: var(--poi, #3ec6e0);
  font-size: 0.78rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.go-here-sheet {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  z-index: 800;
  padding: 20px;
  border-radius: 22px;
  background: rgba(7, 20, 26, 0.96);
  border: 1px solid rgba(62, 198, 224, 0.35);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.go-here-sheet[hidden] { display: none !important; }

.go-here-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: var(--ink);
}

.go-here-kicker {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.go-here-sheet h3 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.go-here-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Map setup (locate + pick dest on map) */
.setup-sheet {
  margin: 0 12px 16px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(7, 20, 26, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-status {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.setup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-actions .flow-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.setup-hint {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.4;
}

.picker-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  max-height: min(72vh, 640px);
  z-index: 850;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: rgba(7, 20, 26, 0.97);
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.picker-sheet[hidden] { display: none !important; }

.picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.picker-head h3 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.picker-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(48vh, 420px);
  padding-bottom: 4px;
}

.map-screen.is-setup-mode .map-filters {
  top: 72px;
}

@media (max-width: 720px) {
  .flow-shell { padding: 16px 14px 28px; }
  .home-brand h1 { font-size: 1.9rem; }
  .home-lead, .flow-copy { font-size: 0.92rem; }
  .choice-card { padding: 14px; gap: 12px; }
  .choice-card strong { font-size: 0.95rem; }
  .choice-card span { font-size: 0.8rem; }

  .map-top-bar {
    padding: 10px 10px 0;
    max-width: calc(100% - 16px);
  }

  .map-top-text {
    padding: 8px 12px;
    max-width: calc(100% - 56px);
  }

  .map-top-text h2 {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-filters {
    top: 70px;
    left: auto;
    right: 10px;
    bottom: auto;
    width: min(168px, 46vw);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 14px;
  }

  .map-screen.is-nav-mode .map-filters {
    top: 78px;
    bottom: auto;
  }

  .map-screen.is-arrived-mode .map-filters {
    top: 78px;
    bottom: auto;
  }

  .map-filters-title {
    width: 100%;
    margin: 0;
    font-size: 0.68rem;
  }

  .map-filter-item {
    font-size: 0.78rem;
    gap: 6px;
    padding: 4px 0;
  }

  .setup-sheet,
  .preview-sheet {
    margin: 0 8px calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 12px;
    max-height: min(42vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }

  .setup-status { font-size: 0.85rem; }
  .setup-hint { font-size: 0.7rem; }

  .picker-sheet {
    max-height: min(78vh, 620px);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .picker-list { max-height: min(50vh, 380px); }

  .preview-stats > div { padding: 10px; font-size: 0.85rem; }
  .preview-desc { font-size: 0.82rem; }
  .preview-hint { font-size: 0.7rem; }
  .flow-btn.lg { padding: 13px 16px; font-size: 0.92rem; }

  .nav-banner {
    margin: 10px 8px 0;
    padding: 10px 12px;
    gap: 8px;
  }

  .nav-banner-info h3 { font-size: 0.88rem; }
  .nav-banner-info p { font-size: 0.72rem; }

  .recenter-btn {
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .arrived-sheet,
  .go-here-sheet {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 16px);
    padding: 16px;
  }

  .leaflet-control-zoom {
    margin-bottom: 12px !important;
  }
}

@media (max-width: 380px) {
  .map-filters { bottom: calc(env(safe-area-inset-bottom, 0px) + 300px); }
  .preview-sheet { max-height: 46vh; }
}

.nav-banner {
  margin: 14px 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(7, 20, 26, 0.92);
  border: 1px solid rgba(62, 198, 224, 0.35);
  box-shadow: var(--shadow);
}

.nav-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: var(--ink);
  display: grid;
  place-items: center;
}

.nav-banner-info { flex: 1; min-width: 0; }
.nav-banner-info h3 { font-size: 0.95rem; }
.nav-banner-info p { color: var(--cyan); font-size: 0.8rem; font-weight: 600; }

.nav-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.nav-icon-btn.stop { border-color: rgba(251, 113, 133, 0.5); color: var(--rose); }

.recenter-btn {
  position: absolute;
  right: 14px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(7, 20, 26, 0.9);
  color: var(--cyan);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.arrived-sheet {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  z-index: 600;
  padding: 22px;
  border-radius: 22px;
  background: rgba(7, 20, 26, 0.95);
  border: 1px solid rgba(45, 212, 168, 0.35);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arrived-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: var(--ink);
  font-size: 1.3rem;
}

.arrived-sheet p { color: var(--muted); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-overlay[hidden] { display: none !important; }

.modal-card {
  width: min(480px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.qr-reader {
  width: 100%;
  min-height: 240px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.qr-file-label { width: 100%; }

.qr-origin-marker { background: transparent !important; border: none !important; }

.qr-you-are-here { position: relative; width: 54px; height: 54px; }

.qr-yah-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(45, 212, 168, 0.35);
  animation: pulse 1.6s ease-out infinite;
}

.qr-yah-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 12px;
}

@keyframes pulse {
  0% { transform: scale(0.55); opacity: 0.9; }
  100% { transform: scale(1.5); opacity: 0; }
}

.custom-gps-pointer-icon { background: transparent !important; border: none !important; }

.gps-pointer-inner {
  width: 28px;
  height: 28px;
  margin: 16px;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 6px rgba(62, 198, 224, 0.25);
}

.gps-radar-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(62, 198, 224, 0.5);
  animation: pulse 1.8s ease-out infinite;
}

@media (max-width: 640px) {
  .flow-shell { padding: 16px 14px 28px; }
  .home-brand h1 { font-size: 1.95rem; }
}
