/* ========================================================
   Geo NLink - Modern Travel & Geo Interface Stylesheet
   ======================================================== */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  --bg-primary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.88);
  --bg-card-border: rgba(255, 255, 255, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --accent-secondary: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.2);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.25);
  --blur: blur(16px);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── MAP CONTAINER ─────────────────────────────────── */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #cbd5e1;
}

/* Custom Leaflet overrides */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-card) !important;
  margin-right: 16px !important;
  margin-top: 80px !important;
}
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--bg-card-border) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: var(--transition);
}
.leaflet-control-zoom a:hover {
  background: #1e293b !important;
  color: var(--accent) !important;
}

/* ── FLOATING TOP HEADER ───────────────────────────── */
.top-header {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.top-header > * {
  pointer-events: auto;
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--bg-card-border);
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-logo span.dot {
  color: var(--accent);
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Dest Tabs */
.dest-tabs {
  display: flex;
  gap: 6px;
}

.dest-tab {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dest-tab.active {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.dest-tab.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Header Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.icon-btn:hover {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.qna-btn {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(56, 189, 248, 0.2));
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.qna-btn:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35), rgba(56, 189, 248, 0.35));
}

/* ── PROGRESS & STATS PILL ─────────────────────────── */
.stats-pill {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--bg-card-border);
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  font-size: 12px;
  font-weight: 600;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-value {
  color: var(--accent);
  font-weight: 700;
}

/* ── FLOATING QUESTION CARD (BOTTOM) ──────────────── */
.bottom-sheet {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 580px;
  z-index: 20;
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.stage-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.question-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  margin-bottom: 8px;
}

.question-hint-box {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.question-hint-box .icon {
  flex-shrink: 0;
  color: var(--warning);
}

/* Multiple choice options (for Stage 3) */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.option-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-btn:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--success) !important;
  color: #34d399 !important;
}

.option-btn.wrong {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: var(--danger) !important;
  color: #f87171 !important;
}

/* Feedback alert */
.feedback-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.45;
  display: none;
  animation: slideUp 0.25s ease;
}

.feedback-box.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.feedback-box.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.next-action-bar {
  margin-top: 12px;
  display: none;
  justify-content: flex-end;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.55);
}

/* ── MAP CUSTOM MARKERS ────────────────────────────── */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #0284c7;
  color: #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  animation: bounceIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-pin span {
  transform: rotate(45deg);
  font-size: 14px;
}

.target-pulse {
  width: 24px;
  height: 24px;
  background: rgba(16, 185, 129, 0.4);
  border: 2px solid #10b981;
  border-radius: 50%;
  position: relative;
  animation: pulseAnim 1.6s infinite ease-out;
}

@keyframes pulseAnim {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3) rotate(-45deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(-45deg); }
  100% { transform: scale(1) rotate(-45deg); opacity: 1; }
}

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

/* ── MODALS (Q&A & SUMMARY CARD) ───────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.modal-container {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  background: #0f172a;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.5);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Q&A Accordion Item */
.qna-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition);
}

.qna-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.qna-question {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.qna-question .q-badge {
  background: #0284c7;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.qna-answer {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  padding-left: 26px;
}

.qna-answer b {
  color: #38bdf8;
}

/* ── SUMMARY REWARD CARD (VIRAL SHARE IMAGE) ──────── */
.summary-card-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

#summaryCard {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(145deg, #090e17 0%, #0f172a 60%, #1e293b 100%);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(56, 189, 248, 0.08);
  position: relative;
  overflow: hidden;
}

#summaryCard::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.card-title-group h2 {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.4px;
}

.card-title-group p {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 3px;
}

.card-score-badge {
  text-align: right;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 12px;
  border-radius: 12px;
}

.card-score-badge .score-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.card-score-badge .score-lbl {
  font-size: 10px;
  color: var(--text-secondary);
}

/* Route Diagrams in Card */
.route-diagram-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.route-flow-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.route-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
}

.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0284c7;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  margin-bottom: 4px;
}

.step-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.step-desc {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 1px;
}

.route-connector {
  flex-grow: 1;
  height: 2px;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  margin: 0 4px;
  margin-top: -16px;
  position: relative;
}

.connector-time {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  background: #0f172a;
  padding: 0 4px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Card Bottom (Branding & QR) */
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.branding-text {
  display: flex;
  flex-direction: column;
}

.branding-logo {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.branding-logo span {
  color: var(--accent);
}

.branding-url {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.branding-scan-tip {
  font-size: 10px;
  color: #38bdf8;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-qr-box {
  width: 60px;
  height: 60px;
  background: #fff;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-qr-box canvas, .card-qr-box img {
  width: 100% !important;
  height: 100% !important;
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions-row button {
  flex: 1;
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
}

/* ── RESPONSIVE MOBILE TWEAKS ──────────────────────── */
@media (max-width: 640px) {
  .top-header {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .brand-bar {
    padding: 6px 12px;
  }
  .brand-logo {
    font-size: 13.5px;
  }
  .brand-badge {
    display: none;
  }
  .dest-tab:not(.active) {
    display: none;
  }
  .icon-btn span.btn-label {
    display: none;
  }
  .icon-btn {
    padding: 8px 10px;
  }
  .stats-pill {
    top: 56px;
    padding: 4px 12px;
    font-size: 11px;
  }
  .bottom-sheet {
    bottom: 12px;
    width: calc(100% - 24px);
    padding: 14px 16px;
  }
  .question-title {
    font-size: 14.5px;
  }
  .leaflet-control-zoom {
    margin-top: 96px !important;
    margin-right: 10px !important;
  }
  #summaryCard {
    padding: 16px;
  }
}
