@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  
  --bg-color: #080c14;
  --panel-bg: rgba(15, 23, 42, 0.65);
  --panel-border: rgba(255, 255, 255, 0.06);
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.2);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --bubble-bg: rgba(30, 41, 59, 0.5);
  --bubble-border: rgba(255, 255, 255, 0.03);
  --accent-bubble: rgba(59, 130, 246, 0.1);
  --accent-bubble-border: rgba(59, 130, 246, 0.2);
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 58, 138, 0.25) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(17, 24, 39, 0.5) 0px, transparent 50%);
}

/* App Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 320px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: flex-col;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h1 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header h1::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-color);
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.target-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.target-item {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.target-item.active {
  background: var(--accent-glow);
  border-color: var(--accent-color);
}

.target-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 500;
}

.target-meta {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* Chat Main View */
.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background: rgba(0, 0, 0, 0.1);
}

.chat-header {
  padding: 20px 24px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.chat-info h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
}

.chat-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.search-container {
  position: relative;
  width: 260px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Message Feed Layout */
.message-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}

.date-divider span {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bubble-border);
  background: var(--bubble-bg);
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  animation: fadeSlideUp 0.3s ease forwards;
}

.message-bubble.self {
  align-self: flex-end;
  background: var(--accent-bubble);
  border-color: var(--accent-bubble-border);
}

.msg-sender {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-color);
}

.msg-text {
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-text a {
  color: #00f0ff;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.msg-text a:hover {
  color: #00ffff;
  text-decoration: underline;
}

.msg-meta {
  align-self: flex-end;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.msg-media {
  margin-top: 8px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.msg-media img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s ease;
}

.msg-media img:hover {
  transform: scale(1.02);
}

.msg-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.msg-file:hover {
  background: rgba(255, 255, 255, 0.04);
}

.msg-file-icon {
  font-size: 20px;
  color: var(--accent-color);
}

.msg-file-info {
  display: flex;
  flex-direction: column;
}

.msg-file-name {
  font-size: 12px;
  font-weight: 500;
}

.msg-file-size {
  font-size: 10px;
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Timeline Scrubber Bar */
.scrubber-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--panel-border);
  z-index: 4;
}

.timeline-label {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  user-select: none;
}

.timeline-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #ec4899);
  opacity: 0.85;
  outline: none;
  cursor: pointer;
  transition: opacity 0.15s ease, height 0.15s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.timeline-slider:hover {
  opacity: 1;
  height: 8px;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #f8fafc;
}

/* Floating Controls */
.feed-controls {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.feed-control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  user-select: none;
  outline: none;
}

.feed-control-btn:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-color);
  transform: translateY(-2px);
  color: #fff;
}

.feed-control-btn:active {
  transform: translateY(0);
}

/* Mobile responsive menu */
.sidebar-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 20;
  margin-right: 16px;
  flex-shrink: 0;
}

.hamburger-bar {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 1px center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 8;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 15;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-toggle-btn {
    display: flex;
  }
  
  .sidebar-toggle-btn.open .hamburger-bar:nth-child(1) {
    transform: rotate(45deg);
  }
  
  .sidebar-toggle-btn.open .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
  }
  
  .sidebar-toggle-btn.open .hamburger-bar:nth-child(3) {
    transform: rotate(-45deg);
  }
  
  .sidebar-overlay.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  
  .chat-header {
    padding: 16px;
  }
  
  .search-container {
    width: 130px;
  }
  
  .message-feed {
    padding: 16px;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}


/* ==========================================================================
   Interactive Map & Navigation Engine Styles
   ========================================================================== */

/* Mode Switcher Navigation */
.view-mode-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
  border: 1px solid var(--panel-border);
}

.mode-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mode-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.mode-tab-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Map Container Layout */
#map-view-container {
  display: none;
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#map-view-container.active {
  display: flex;
}

#leaflet-map {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #0b0f19;
  z-index: 1;
}

/* Map Header Floating Filter Overlay */
.map-toolbar {
  position: absolute;
  top: 16px;
  left: 60px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.map-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-filter-btn:hover, .map-filter-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.map-stats-badge {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Documentation View Container */
#docs-view-container {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px;
  background: rgba(8, 12, 20, 0.95);
  color: var(--text-primary);
}

#docs-view-container.active {
  display: block;
}

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.doc-nav-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.doc-nav-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.doc-nav-card h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  margin-bottom: 8px;
  color: #38bdf8;
}

.doc-nav-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Custom Leaflet Dark Popups */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md) !important;
  padding: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6) !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
}

.map-popup-card {
  min-width: 220px;
  max-width: 280px;
  font-family: var(--font-sans);
}

.popup-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  background: var(--accent-color);
  color: #fff;
}

.popup-badge.campsite { background: #10b981; }
.popup-badge.water { background: #06b6d4; }
.popup-badge.bike_shop { background: #f59e0b; }
.popup-badge.hazard { background: #ef4444; }

.map-popup-card h4 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #f8fafc;
}

.popup-date {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.popup-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
  max-height: 90px;
  overflow-y: auto;
}

.popup-coords {
  font-family: monospace;
  font-size: 10px;
  color: #64748b;
  margin-bottom: 8px;
}

.popup-actions {
  display: flex;
  gap: 6px;
}

.popup-btn {
  flex: 1;
  text-align: center;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.popup-btn.osmand-btn {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.popup-btn.osmand-btn:hover {
  background: #10b981;
  color: #fff;
}

.popup-btn.gmaps-btn {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.popup-btn.gmaps-btn:hover {
  background: #3b82f6;
  color: #fff;
}

/* Map Layer Toggle Checkbox Pills */
.map-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  user-select: none;
}

.map-toggle-label:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.map-toggle-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent-color);
  width: 14px;
  height: 14px;
}
