/* =============================================
   Zurich Facts — Styles
   Mobile-first design with dark theme
   ============================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0f1e;
  --bg-card: #111827;
  --bg-card-hover: #1a2440;
  --accent: #2e86de;
  --accent-glow: rgba(46, 134, 222, 0.3);
  --accent-secondary: #1b3a5c;
  --text-primary: #eaeef4;
  --text-secondary: #9bafc8;
  --text-muted: #5a7080;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Screen System ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 5;
}

/* ---------- Splash Screen ---------- */
.splash-content {
  text-align: center;
  z-index: 2;
  position: relative;
}

.logo-container {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.logo-pin {
  font-size: 72px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(46, 134, 222, 0.4));
}

.logo-glow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 12px;
  background: var(--accent-glow);
  border-radius: 50%;
  filter: blur(8px);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.8; transform: translateX(-50%) scale(1.3); }
}

.app-title {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), #54a0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.app-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 48px;
  font-weight: 300;
}

.permission-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  opacity: 0.7;
}

.legal-link {
  color: var(--accent);
  text-decoration: none;
  opacity: 1;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  display: inline;
}

.legal-link:hover {
  text-decoration: underline;
}

/* Background shapes */
.splash-bg-shapes {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: var(--accent);
  top: -100px;
  right: -80px;
  animation: drift 12s ease-in-out infinite;
}

.shape-2 {
  width: 200px;
  height: 200px;
  background: #1a5276;
  bottom: 10%;
  left: -60px;
  animation: drift 15s ease-in-out infinite reverse;
}

.shape-3 {
  width: 250px;
  height: 250px;
  background: var(--accent-secondary);
  bottom: -80px;
  right: 20%;
  animation: drift 18s ease-in-out infinite;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(20px, -30px); }
  66% { transform: translate(-15px, 20px); }
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  font-size: 17px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent), #1a5fa0);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 30px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(46, 134, 222, 0.12);
  border: 1.5px solid rgba(46, 134, 222, 0.3);
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  margin-top: 16px;
}

.btn-secondary:active {
  transform: scale(0.96);
  background: rgba(46, 134, 222, 0.2);
}

.btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  margin-top: 10px;
}

.btn-tertiary:active {
  transform: scale(0.96);
  color: var(--text-primary);
}

.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  flex-shrink: 0;
}

.btn-icon {
  font-size: 20px;
}

/* ---------- Loading / Radar ---------- */
.loading-content {
  text-align: center;
}

.radar-container {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 32px;
}

.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: radar-pulse 2.4s ease-out infinite;
}

.radar-ring-2 { animation-delay: 0.8s; }
.radar-ring-3 { animation-delay: 1.6s; }

@keyframes radar-pulse {
  0% { transform: scale(0.3); opacity: 0.8; }
  100% { transform: scale(1); opacity: 0; }
}

.radar-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--accent-glow), 0 0 60px var(--accent-glow);
}

.loading-text {
  font-size: 16px;
  color: var(--text-secondary);
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes fade-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ---------- Fact Screen (TikTok-style feed) ---------- */
#fact-screen {
  justify-content: stretch;
  padding: 0;
}

.fact-feed {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.fact-slide {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.fact-card-container,
.fact-slide > .fact-card {
  width: 100%;
  max-width: 420px;
}

.fact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  animation: card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.fact-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #54a0ff, var(--accent));
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(40px) rotateX(8deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.fact-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: rgba(46, 134, 222, 0.12);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.category-emoji {
  font-size: 15px;
}

.fact-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.fact-divider {
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 16px;
}

.fact-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Google Maps link on fact cards */
.fact-location-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 8px;
  transition: color 0.2s;
}

.fact-location-link:hover {
  color: var(--accent);
}

.fact-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.fact-distance,
.fact-city {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-icon {
  font-size: 14px;
}

.fact-source-link {
  display: inline-block;
  margin-top: 10px;
  padding: 0;
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.fact-source-link:hover {
  opacity: 1;
}

/* ---------- Star Rating ---------- */
.fact-rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.rating-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rating-stars {
  display: flex;
  gap: 4px;
}

.rating-stars .star {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.rating-stars .star:active {
  transform: scale(1.3);
}

.rating-stars .star.active {
  color: #f5a623;
}

.rating-thanks {
  font-size: 13px;
  color: #f5a623;
  opacity: 0;
  transition: opacity 0.3s;
}

.fact-rating.rated .rating-label {
  display: none;
}

.fact-rating.rated .rating-thanks {
  opacity: 1;
}

.fact-rating.rated .rating-stars .star {
  pointer-events: none;
}

/* ---------- Swipe hint ---------- */
.swipe-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.swipe-hint.visible {
  opacity: 1;
  animation: hint-bounce 1.2s ease-in-out infinite;
}

.swipe-hint-arrow {
  font-size: 20px;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

/* Floating action bar at bottom of fact screen */
.fact-screen-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg-dark) 60%, transparent);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.fact-screen-actions::-webkit-scrollbar { display: none; }

.fact-screen-actions .btn-tertiary {
  flex-shrink: 0;
  margin-top: 0;
}

.btn-tip {
  text-decoration: none;
  color: var(--text-primary);
  border-color: #ffdd00;
  background: rgba(255, 221, 0, 0.08);
}
.btn-tip:hover,
.btn-tip:active {
  background: rgba(255, 221, 0, 0.18);
}

/* ---------- Error Screen ---------- */
.error-content {
  text-align: center;
}

.error-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

.error-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-message {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 300px;
  line-height: 1.6;
}

/* ---------- Utility ---------- */
@media (prefers-color-scheme: light) {
  /* Keep dark theme always — this is a deliberate design choice */
}

/* Larger phones / small tablets */
@media (min-width: 420px) {
  .fact-card {
    padding: 32px 28px;
  }
  .fact-title {
    font-size: 26px;
  }
  .app-title {
    font-size: 52px;
  }
}

/* ---------- Map Screen ---------- */
#map-screen {
  padding: 0;
  justify-content: flex-start;
}

.map-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(to bottom, var(--bg-dark) 60%, transparent);
}

.map-title {
  font-size: 20px;
  font-weight: 700;
}

.map-container {
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
}

/* User location dot */
.map-user-marker {
  background: none !important;
  border: none !important;
}

.user-dot {
  width: 16px;
  height: 16px;
  background: #4285f4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(66, 133, 244, 0.6);
}

/* Fact markers */
.map-fact-marker {
  background: none !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-emoji {
  font-size: 24px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* Mystery markers for distant facts */
.map-mystery-marker {
  background: none !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mystery-count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(46, 134, 222, 0.15);
  border: 2px dashed rgba(46, 134, 222, 0.5);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  animation: mystery-pulse 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(46, 134, 222, 0.3));
}

@keyframes mystery-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 1; }
}

.mystery-popup strong {
  color: var(--accent);
}

.mystery-popup p {
  font-style: italic;
}

/* Dark popup */
.dark-popup .leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.dark-popup .leaflet-popup-tip {
  background: var(--bg-card);
}

.dark-popup .leaflet-popup-close-button {
  color: var(--text-muted);
}

.map-popup strong {
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}

.map-popup p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Legal Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.overlay-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.overlay.active .overlay-panel {
  transform: translateY(0);
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.overlay-title {
  font-size: 20px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close:hover {
  color: var(--text-primary);
}

.overlay-body {
  padding: 20px 24px 32px;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.legal-section {
  margin-bottom: 28px;
}

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

.legal-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.legal-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-left: 20px;
  margin: 0;
}

.legal-section ul li {
  margin-bottom: 4px;
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-section strong {
  color: var(--text-primary);
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg-dark: #f0f4f8;
  --bg-card: #ffffff;
  --bg-card-hover: #e8eef4;
  --accent: #1a6fb5;
  --accent-glow: rgba(26, 111, 181, 0.2);
  --accent-secondary: #c5ddf0;
  --text-primary: #1a2030;
  --text-secondary: #4a5568;
  --text-muted: #8899aa;
  --border: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .fact-card {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .shape { opacity: 0.08; }

[data-theme="light"] .fact-screen-actions {
  background: linear-gradient(to top, var(--bg-dark) 60%, transparent);
}

[data-theme="light"] .map-header {
  background: linear-gradient(to bottom, var(--bg-dark) 60%, transparent);
}

/* ---------- Fact Top Bar ---------- */
.fact-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(to bottom, var(--bg-dark) 70%, transparent);
  pointer-events: none;
}

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

.fact-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.fact-top-actions {
  display: flex;
  gap: 8px;
}

.btn-icon-only {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-icon-only:active {
  transform: scale(0.9);
}

/* ---------- Filter Bar ---------- */
.filter-bar {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 19;
  display: flex;
  gap: 8px;
  padding: 8px 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  pointer-events: auto;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-chip.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-chip:active {
  transform: scale(0.95);
}

/* ---------- Share Button ---------- */
.btn-share {
  display: inline-block;
  margin-top: 10px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-share:active {
  opacity: 1;
}

/* ---------- Walking Mode ---------- */
.btn-tertiary.walking-active {
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.4);
  background: rgba(39, 174, 96, 0.1);
}



/* ---------- Submit Form ---------- */
.submit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-note {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-submit-send {
  align-self: flex-start;
}

.submit-status {
  font-size: 13px;
  color: var(--accent);
  min-height: 20px;
}
