/* ============================================
   WAYSIDE - Location-Aware Tour Guide PWA
   Design System & Global Styles
   ============================================ */

:root {
  /* Colors - Dark theme (primary, good for outdoor use) */
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-elevated: #1e2a4a;
  --bg-overlay: rgba(15, 15, 26, 0.95);

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b82;
  --text-accent: #64b5f6;

  --accent-primary: #4fc3f7;
  --accent-secondary: #81c784;
  --accent-warm: #ffb74d;
  --accent-danger: #ef5350;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);

  /* Category colors */
  --cat-history: #ffb74d;
  --cat-nature: #81c784;
  --cat-true-crime: #ef5350;
  --cat-trivia: #ba68c8;
  --cat-folklore: #4dd0e1;
  --cat-ecology: #aed581;

  /* Typography */
  --font-reading: 'Merriweather', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

#root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--safe-top) var(--space-md) 0;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.header-logo {
  font-family: var(--font-reading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.header-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.gps-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-secondary);
  animation: pulse 2s ease-in-out infinite;
}

.gps-indicator.no-signal {
  background: var(--accent-danger);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Mode Toggle ---- */
.mode-toggle {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.mode-toggle button {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mode-toggle button:active {
  opacity: 0.7;
}

.mode-toggle button.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(70px + var(--safe-bottom));
}

/* When map is active, content area needs to be a flex container
   so the map can fill available height without scroll */
.main-content--map,
.main-content:has(.map-view-screen) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(60px + var(--safe-bottom));
}

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 0 var(--space-md) var(--safe-bottom);
  backdrop-filter: blur(10px);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px var(--space-sm);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.2s ease;
  min-width: 64px;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  opacity: 0.6;
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

/* ---- Speed Badge ---- */
.speed-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.speed-badge.stationary { background: rgba(160,160,184,0.2); color: var(--text-secondary); }
.speed-badge.walking { background: rgba(129,199,132,0.2); color: var(--accent-secondary); }
.speed-badge.driving { background: rgba(79,195,247,0.2); color: var(--accent-primary); }

/* ---- Category Badges ---- */
.category-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-badge.history { background: rgba(255,183,77,0.2); color: var(--cat-history); }
.category-badge.nature { background: rgba(129,199,132,0.2); color: var(--cat-nature); }
.category-badge.true-crime { background: rgba(239,83,80,0.2); color: var(--cat-true-crime); }
.category-badge.trivia { background: rgba(186,104,200,0.2); color: var(--cat-trivia); }
.category-badge.folklore { background: rgba(77,208,225,0.2); color: var(--cat-folklore); }
.category-badge.ecology { background: rgba(174,213,129,0.2); color: var(--cat-ecology); }

/* ---- POI Card ---- */
.poi-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.poi-card.has-thumb {
  display: flex;
  gap: var(--space-md);
  align-items: stretch;
}

.poi-card-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  align-self: center;
}

.poi-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poi-card-body {
  flex: 1;
  min-width: 0;
}

.poi-card:active {
  transform: scale(0.98);
  background: var(--bg-elevated);
}

.poi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.poi-card-title {
  font-family: var(--font-reading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.poi-card-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: var(--space-sm);
}

.poi-card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.poi-card-categories {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.poi-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

/* ---- Content Reader (Wikipedia-style) ---- */
.content-reader {
  padding: var(--space-lg) var(--space-md);
  max-width: 680px;
  margin: 0 auto;
}

.content-reader-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--accent-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
}

.content-reader h1 {
  font-family: var(--font-reading);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.content-reader .content-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.content-tier-selector {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  padding: 2px;
  margin-bottom: var(--space-lg);
}

.content-tier-selector button {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.content-tier-selector button.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.content-body {
  font-family: var(--font-reading);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.content-body p {
  margin-bottom: 1.2em;
}

.content-body h2 {
  font-family: var(--font-reading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-subtle);
}

.content-body h3 {
  font-family: var(--font-reading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.2em;
  margin-bottom: 0.4em;
}

.content-body blockquote {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-md);
  margin: 1em 0;
  color: var(--text-muted);
  font-style: italic;
}

.content-body ul, .content-body ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

.content-body li {
  margin-bottom: 0.4em;
}

.content-source {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Content Nav (Next/Prev) ---- */
.content-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  gap: var(--space-md);
}

.content-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.content-nav-btn:active:not(:disabled) {
  transform: scale(0.95);
  background: var(--bg-elevated);
}

.content-nav-btn:disabled {
  cursor: default;
}

.content-nav-btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Auto Mode Screen ---- */
.auto-mode {
  padding: var(--space-md);
}

.auto-mode-hero {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.auto-mode-hero h2 {
  font-family: var(--font-reading);
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.auto-mode-hero p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.approaching-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-md);
  border: 1px solid var(--accent-primary);
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.1);
}

.approaching-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: var(--space-sm);
}

.approaching-card h3 {
  font-family: var(--font-reading);
  font-size: 1.3rem;
  margin-bottom: var(--space-xs);
}

.approaching-card .distance {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Playlist Screen ---- */
.playlist-screen {
  padding: var(--space-md);
}

.playlist-header {
  padding: var(--space-md) 0;
}

.playlist-header h2 {
  font-family: var(--font-reading);
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
}

.playlist-header .stats {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.playlist-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.playlist-empty p {
  margin-bottom: var(--space-sm);
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.playlist-item:active {
  transform: scale(0.98);
}

.playlist-item.active {
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
}

.chapter-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.playlist-item.active .chapter-number {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-family: var(--font-reading);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.playlist-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-sm);
  font-size: 1.2rem;
  line-height: 1;
}

/* ---- Add to Playlist Button ---- */
.btn-add-playlist {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-playlist:hover, .btn-add-playlist:active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-add-playlist.added {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  background: rgba(129,199,132,0.1);
}

/* ---- Settings Screen ---- */
.settings-screen {
  padding: var(--space-md);
}

.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row label {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.settings-row .value {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Debug Panel ---- */
.debug-panel {
  position: fixed;
  bottom: 70px;
  right: var(--space-md);
  background: var(--bg-overlay);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.65rem;
  font-family: monospace;
  color: var(--accent-secondary);
  z-index: 50;
  max-width: 200px;
}

.debug-panel p {
  margin-bottom: 2px;
}

/* ---- Utility ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.loading-spinner::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

/* ---- Toast Notification ---- */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.filter-bar {
  -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
  mask-image: linear-gradient(to right, black 90%, transparent 100%);
  padding-right: var(--space-lg);
}

.filter-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: capitalize;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:active {
  opacity: 0.6;
}

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

/* ============================================
   Entry Tools - Shared
   ============================================ */

.entry-tool {
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.entry-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.entry-tool-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.entry-tool-label svg {
  opacity: 0.7;
}

.entry-tool-expand-btn {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.entry-tool-expand-btn:active {
  background: var(--border-medium);
}

.entry-tool-caption {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.entry-tool-credit {
  opacity: 0.6;
  font-style: italic;
}

/* ============================================
   Entry Tools - MapPane
   ============================================ */

.entry-tool-map-container {
  width: 100%;
  background: var(--bg-primary);
}

.entry-tool-map--compact .entry-tool-map-container {
  pointer-events: none;
  opacity: 0.8;
}

/* Override Leaflet popup styles for dark theme */
.entry-tool-map-popup .leaflet-popup-content-wrapper {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.entry-tool-map-popup .leaflet-popup-tip {
  background: var(--bg-elevated);
}

.entry-tool-map-popup .leaflet-popup-content {
  margin: 8px 12px;
  line-height: 1.4;
}

.entry-tool-map-popup .leaflet-popup-content strong {
  color: var(--accent-primary);
}

/* Fix Leaflet zoom controls for dark theme */
.entry-tool-map-container .leaflet-control-zoom a {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

/* ============================================
   Entry Tools - ImageGallery
   ============================================ */

.entry-tool-gallery-frame {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.entry-tool-gallery-frame img {
  transition: transform 0.3s ease;
}

.entry-tool-gallery-frame:active img {
  transform: scale(1.02);
}

.entry-tool-gallery-nav {
  display: flex;
  gap: 4px;
}

.entry-tool-gallery-nav button {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.entry-tool-gallery-nav button:active {
  background: var(--border-medium);
}

.entry-tool-gallery-thumbs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.entry-tool-gallery-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: none;
  padding: 0;
  transition: border-color 0.2s ease;
}

.entry-tool-gallery-thumb.active {
  border-color: var(--accent-primary);
}

.entry-tool-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lightbox */
.entry-tool-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}

.entry-tool-lightbox img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.entry-tool-lightbox-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.entry-tool-lightbox-caption {
  margin-top: var(--space-md);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  text-align: center;
  max-width: 600px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Compare / Before-After */
.entry-tool-compare {
  touch-action: none;
  user-select: none;
}

.entry-tool-compare img {
  pointer-events: none;
}

.entry-tool-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.entry-tool-compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: white;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.entry-tool-compare-grip {
  position: relative;
  background: white;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 11;
}

.entry-tool-compare-label {
  position: absolute;
  bottom: var(--space-sm);
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
}

.entry-tool-compare-label--left {
  left: var(--space-sm);
}

.entry-tool-compare-label--right {
  right: var(--space-sm);
}

/* Compact gallery */
.entry-tool-gallery--compact {
  border: none;
  background: none;
}

/* ============================================
   Map View Screen
   ============================================ */

.map-view-screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.map-view-container {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.map-view-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Cluster icons (dark theme) ---- */
.map-cluster-icon {
  background: none !important;
  border: none !important;
}

.map-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--bg-primary);
  text-align: center;
  line-height: 1;
}

.map-cluster--small {
  width: 34px;
  height: 34px;
  font-size: 0.7rem;
  background: rgba(79, 195, 247, 0.85);
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.4);
}

.map-cluster--medium {
  width: 40px;
  height: 40px;
  font-size: 0.8rem;
  background: rgba(100, 181, 246, 0.9);
  box-shadow: 0 0 14px rgba(100, 181, 246, 0.4);
}

.map-cluster--large {
  width: 48px;
  height: 48px;
  font-size: 0.9rem;
  background: rgba(129, 199, 132, 0.9);
  box-shadow: 0 0 18px rgba(129, 199, 132, 0.4);
}

/* ---- POI marker overrides ---- */
.map-poi-marker {
  background: none !important;
  border: none !important;
}

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

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

.map-user-dot-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.15);
  animation: mapUserPulse 2s ease-in-out infinite;
}

@keyframes mapUserPulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

/* ---- Map Search Bar ---- */
.map-search {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 15;
}

.map-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0 var(--space-md);
  height: 38px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease;
}

.map-search-bar:focus-within {
  border-color: var(--accent-primary);
}

.map-search-icon {
  flex-shrink: 0;
  opacity: 0.5;
}

.map-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  min-width: 0;
}

.map-search-input::placeholder {
  color: var(--text-muted);
}

.map-search-clear {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.map-search-clear:active {
  color: var(--text-primary);
}

/* Results dropdown */
.map-search-results {
  margin-top: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.map-search-result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  transition: background 0.15s ease;
}

.map-search-result:last-child {
  border-bottom: none;
}

.map-search-result:hover,
.map-search-result:active {
  background: var(--bg-elevated);
}

.map-search-result-color {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
}

.map-search-result-info {
  flex: 1;
  min-width: 0;
}

.map-search-result-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-search-result-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.map-search-result-dist {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Fly-to-user button ---- */
.map-locate-btn {
  position: absolute;
  top: 56px;
  left: 12px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.map-locate-btn:active {
  transform: scale(0.9);
  background: var(--accent-primary);
  color: var(--bg-primary);
}

/* ---- POI count badge ---- */
.map-poi-count {
  position: absolute;
  top: 56px;
  left: 60px;
  z-index: 10;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---- Preview card (bottom slide-up) ---- */
.map-preview-card {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + 8px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  animation: mapSlideUp 0.25s ease-out;
  max-height: 50vh;
  overflow-y: auto;
}

@keyframes mapSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.map-preview-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.map-preview-close:active {
  background: var(--border-subtle);
}

.map-preview-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.map-preview-thumb {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}

.map-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-preview-info {
  flex: 1;
  min-width: 0;
}

.map-preview-title {
  font-family: var(--font-reading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.map-preview-visited {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-secondary);
  background: rgba(129, 199, 132, 0.15);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}

.map-preview-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-preview-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.map-preview-distance {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.map-preview-brief {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.map-preview-brief-title {
  font-family: var(--font-reading);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.map-preview-brief-text {
  font-family: var(--font-reading);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.map-preview-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.map-preview-categories {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.map-preview-details {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.map-preview-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.map-preview-detail-item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.map-preview-detail-item--accent {
  color: var(--accent-primary);
  font-weight: 600;
}

.map-preview-region {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: var(--space-sm);
}

.map-preview-source {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.map-preview-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.map-preview-read-btn {
  flex: 1;
}

/* ---- Override Leaflet controls for dark theme ---- */
.map-view-container .leaflet-control-zoom a {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

.map-view-container .leaflet-control-zoom a:hover {
  background: var(--bg-card) !important;
}

/* Override MarkerCluster default styles */
.map-view-container .marker-cluster-small,
.map-view-container .marker-cluster-medium,
.map-view-container .marker-cluster-large {
  background: none !important;
}
.map-view-container .marker-cluster-small div,
.map-view-container .marker-cluster-medium div,
.map-view-container .marker-cluster-large div {
  background: none !important;
}

/* Leaflet popup overrides for map view */
.map-view-container .leaflet-popup-content-wrapper {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.map-view-container .leaflet-popup-tip {
  background: var(--bg-elevated);
}

/* ============================================
   TRIP PLANNER
   ============================================ */

.trip-planner {
  padding: var(--space-md);
}

/* ---- Trip List ---- */
.trip-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.trip-list-header h2 {
  font-family: var(--font-reading);
  font-size: 1.5rem;
  font-weight: 700;
}

.trip-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.trip-new-form {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-medium);
}

.trip-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
}

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

.trip-input-title {
  font-family: var(--font-reading);
  font-size: 1.3rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent-primary);
  border-radius: 0;
  padding: 4px 0;
}

.trip-input-sm {
  font-size: 0.85rem;
  padding: 4px 8px;
}

.trip-new-days {
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.trip-new-days label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.trip-day-picker {
  display: flex;
  gap: 6px;
}

.trip-day-pick {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.trip-day-pick.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.trip-new-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ---- Trip Card ---- */
/* Trip card row: card + optional reorder arrows */
.trip-card-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.trip-card-row.active .trip-card {
  border-color: var(--accent-warm);
}

.trip-card-reorder {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.trip-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.trip-card:active {
  transform: scale(0.98);
  background: var(--bg-elevated);
}

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.trip-card-name {
  font-family: var(--font-reading);
  font-size: 1.1rem;
  font-weight: 700;
}

.trip-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trip-card-cats {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.trip-card-days {
  display: flex;
  gap: 4px;
  margin-top: var(--space-sm);
}

.trip-day-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trip-day-dot.filled {
  background: rgba(79, 195, 247, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ---- Trip Detail ---- */
.trip-detail {
  padding: var(--space-md);
}

.trip-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.trip-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--accent-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.trip-detail-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.trip-detail-name {
  margin-bottom: var(--space-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.trip-detail-name h2 {
  font-family: var(--font-reading);
  font-size: 1.5rem;
}

.trip-edit-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.trip-detail-name:hover .trip-edit-hint,
.trip-day-label:hover .trip-edit-hint {
  opacity: 1;
}

.trip-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.trip-share-url {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(79, 195, 247, 0.1);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  font-size: 0.75rem;
  color: var(--accent-primary);
}

.trip-share-url input {
  flex: 1;
  font-size: 0.7rem;
}

/* ---- Day Block ---- */
.trip-day {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-subtle);
}

.trip-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.trip-day-label {
  font-family: var(--font-reading);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.trip-day-date {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.trip-day-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trip-remove-day {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.trip-remove-day:hover {
  color: var(--accent-danger);
}

/* ---- Time Block ---- */
.trip-time-block {
  margin-bottom: var(--space-md);
}

.trip-time-block:last-child {
  margin-bottom: 0;
}

.trip-time-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trip-time-icon {
  font-size: 0.9rem;
}

.trip-time-count {
  font-size: 0.65rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  color: var(--text-muted);
}

.trip-time-items {
  padding-left: 24px;
  border-left: 2px solid var(--border-subtle);
}

.trip-time-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: var(--space-sm) 0;
  font-style: italic;
}

/* ---- Trip POI Item ---- */
.trip-poi-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.trip-poi-item:hover {
  background: var(--bg-elevated);
}

.trip-poi-color {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.trip-poi-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.trip-poi-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trip-poi-info {
  flex: 1;
  min-width: 0;
}

.trip-poi-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-poi-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-poi-time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.trip-poi-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.trip-poi-remove:hover {
  color: var(--accent-danger);
}

.trip-add-day-btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.trip-add-day-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ---- Add to Trip Sheet (overlay) ---- */
.trip-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trip-sheet {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md);
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
}

.trip-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.trip-sheet-header h3 {
  font-family: var(--font-reading);
  font-size: 1.2rem;
}

.trip-sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.trip-sheet-poi {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.trip-sheet-poi-name {
  font-family: var(--font-reading);
  font-weight: 700;
  font-size: 1rem;
}

.trip-sheet-section {
  margin-bottom: var(--space-md);
}

.trip-sheet-section label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.trip-sheet-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.trip-sheet-option {
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.trip-sheet-option:active {
  opacity: 0.6;
}

.trip-sheet-option.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.trip-sheet-blocks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.trip-sheet-block {
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius-md);
}

.trip-sheet-confirm {
  width: 100%;
  margin-top: var(--space-md);
}

.trip-sheet-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.trip-sheet-empty {
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-muted);
}

/* ============================================
   AREA SUMMARY
   ============================================ */

.area-summary {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md);
  border: 1px solid rgba(79, 195, 247, 0.3);
  position: relative;
}

.area-summary-dismiss {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.area-summary-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.area-summary-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.area-summary-title {
  font-family: var(--font-reading);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.area-summary-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Category Bar ---- */
.area-summary-cats {
  margin-bottom: var(--space-md);
}

.area-cat-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  gap: 1px;
  margin-bottom: var(--space-sm);
}

.area-cat-segment {
  min-width: 4px;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.area-cat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.area-cat-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.area-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ---- Highlights ---- */
.area-summary-highlights {
  margin-bottom: var(--space-md);
}

.area-highlights-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.area-highlight-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.area-highlight-item:hover {
  opacity: 0.8;
}

.area-highlight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.area-highlight-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.area-highlight-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.area-highlight-dist {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: var(--space-sm);
}

.area-highlight-badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-primary);
  padding: 1px 6px;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.area-summary-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ============================================
   POI ACTION ROW (Playlist + Trip buttons)
   ============================================ */

.poi-action-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn-add-trip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--accent-warm);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-add-trip:hover,
.btn-add-trip:active {
  background: rgba(255, 183, 77, 0.1);
  border-color: var(--accent-warm);
}

.btn-add-trip svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   SHARED UTILITIES
   ============================================ */

.btn-sm {
  font-size: 0.75rem !important;
  padding: 5px 12px !important;
}

.btn-danger {
  color: var(--accent-danger) !important;
  border-color: rgba(239, 83, 80, 0.3) !important;
}

.btn-danger:hover {
  background: rgba(239, 83, 80, 0.1) !important;
}

/* ============================================
   Offline Status
   ============================================ */

.trip-offline-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.trip-offline-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.trip-offline-info {
  flex: 1;
  min-width: 0;
}

.trip-offline-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.trip-offline-detail {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Caching in progress */
.trip-offline-caching {
  border-color: rgba(79, 195, 247, 0.3);
}

.trip-offline-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.trip-offline-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-warm), #4fc3f7);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Ready state */
.trip-offline-ready {
  border-color: rgba(102, 187, 106, 0.3);
}

.trip-offline-ready .trip-offline-label {
  color: #66bb6a;
}

/* Pending state */
.trip-offline-pending {
  border-color: rgba(255, 183, 77, 0.2);
}

/* Global offline banner */
.offline-banner {
  background: linear-gradient(90deg, rgba(255, 183, 77, 0.15), rgba(255, 183, 77, 0.08));
  color: #ffb74d;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 0;
  letter-spacing: 0.03em;
}

/* ============================================
   Reorder Controls
   ============================================ */

.reorder-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.55rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.reorder-btn:not(:disabled):active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.reorder-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.reorder-btn-sm {
  width: 20px;
  height: 16px;
  font-size: 0.5rem;
}

/* Day reorder */
.trip-day-reorder {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 8px;
  flex-shrink: 0;
}

.trip-day-header {
  display: flex;
  align-items: center;
}

.trip-day-header-text {
  flex: 1;
  min-width: 0;
}

/* POI reorder */
.trip-poi-reorder {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-right: 6px;
  flex-shrink: 0;
  align-self: center;
}

.trip-poi-item {
  position: relative;
}

.trip-poi-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 4px;
}

.trip-poi-move-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}

.trip-poi-move-btn:active {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Move menu — bottom sheet style on mobile for safe positioning */
.trip-poi-move-menu {
  position: fixed;
  left: var(--space-sm);
  right: var(--space-sm);
  bottom: calc(70px + var(--safe-bottom));
  z-index: 150;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 0;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

.trip-poi-move-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px 6px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.trip-poi-move-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.trip-poi-move-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.trip-poi-move-option:active {
  background: rgba(255, 255, 255, 0.06);
}

.trip-poi-move-icon {
  margin-right: 4px;
}

/* ---- Edit Mode Active Button ---- */
.btn-edit-active {
  background: rgba(79, 195, 247, 0.15) !important;
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

/* ---- Global Touch Improvements ---- */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* ---- Map Preview Card Mobile Fixes ---- */
@media (max-height: 700px) {
  .map-preview-card {
    max-height: 40vh;
  }
  .map-preview-thumb {
    height: 120px;
  }
}

/* ============================================
   TABLET RESPONSIVE (768px+)
   ============================================ */

@media (min-width: 768px) {
  /* Header breathes more on tablet */
  .header-inner {
    height: 56px;
    max-width: 960px;
    margin: 0 auto;
  }

  .header-logo {
    font-size: 1.4rem;
  }

  .mode-toggle button {
    font-size: 0.85rem;
    padding: 8px 18px;
  }

  /* Main content centered on tablet */
  .main-content {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
  }

  /* Bottom nav items spread with larger targets */
  .bottom-nav-inner {
    max-width: 600px;
    margin: 0 auto;
  }

  .nav-item {
    font-size: 0.75rem;
    min-width: 80px;
  }

  .nav-item svg {
    width: 26px;
    height: 26px;
  }

  /* POI cards: larger thumbnails */
  .poi-card.has-thumb .poi-card-thumb {
    width: 100px;
    height: 100px;
  }

  .poi-card-title {
    font-size: 1.15rem;
  }

  /* Content reader: centered reading column */
  .content-reader {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-xl);
  }

  /* Trip planner: wider day blocks */
  .trip-planner {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
  }

  .trip-detail {
    max-width: 720px;
    margin: 0 auto;
  }

  /* Trip POI items roomier on tablet */
  .trip-poi-item {
    padding: var(--space-sm) var(--space-md);
  }

  .trip-poi-thumb {
    width: 56px;
    height: 56px;
  }

  /* Trip sheet centered, not full width */
  .trip-sheet {
    max-width: 480px;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
  }

  .trip-sheet-overlay {
    align-items: center;
  }

  /* Move menu: centered overlay on tablet instead of bottom sheet */
  .trip-poi-move-menu {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    position: fixed;
    width: 320px;
    max-height: 60vh;
    border-radius: var(--radius-lg);
  }

  /* Map preview card: roomier on tablet */
  .map-preview-card {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg);
    max-height: 50vh;
  }

  @keyframes mapSlideUp {
    from { transform: translateX(-50%) translateY(100%); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
  }

  /* Map search bar wider on tablet */
  .map-search-bar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
  }

  .map-search-results {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
  }

  /* Filter bar: no fade mask on tablet (enough room) */
  .filter-bar {
    -webkit-mask-image: none;
    mask-image: none;
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Playlist centered */
  .playlist-screen {
    max-width: 640px;
    margin: 0 auto;
  }

  /* Settings centered */
  .settings-screen {
    max-width: 640px;
    margin: 0 auto;
  }

  /* Area summary card */
  .area-summary-card {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Trip list cards */
  .trip-card {
    max-width: 640px;
  }
}

/* ============================================
   LARGE TABLET / SMALL DESKTOP (1024px+)
   ============================================ */

@media (min-width: 1024px) {
  .main-content {
    max-width: 1100px;
  }

  .header-inner {
    max-width: 1100px;
  }

  /* Two-column POI layout for manual mode */
  .manual-poi-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  /* Trip detail: wider with more padding */
  .trip-detail {
    max-width: 800px;
  }

  .content-reader {
    max-width: 760px;
    padding: var(--space-xl) var(--space-2xl);
  }
}
