/* ==========================================================================
   MemMapper - Premium Design System & Styles
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  /* Color Palette */
  --bg-primary: #030712;       /* Deep space black */
  --bg-secondary: #0b1329;     /* Deep slate blue */
  --bg-sidebar: rgba(11, 19, 41, 0.85); /* Glassmorphism sidebar bg */
  
  --text-primary: #ffffff;     /* Solid White */
  --text-secondary: #d1d5db;   /* Light gray */
  --text-muted: #9ca3af;       /* Medium gray (passes WCAG AAA 7:1) */
  
  /* Accent Colors (Neon Theme - WCAG AAA Compliant) */
  --accent-primary: #c084fc;   /* Electric Violet (Lighter for >7:1 contrast) */
  --accent-secondary: #67e8f9; /* Radiant Cyan (Lighter for >7:1 contrast) */
  --accent-success: #6ee7b7;   /* Emerald Green (Lighter for >7:1 contrast) */
  --accent-danger: #fca5a5;    /* Crimson Red (Lighter for >7:1 contrast) */
  --accent-warning: #fde047;   /* Amber Gold (Lighter for >7:1 contrast) */
  
  /* Category Colors */
  --cat-adventure: #ff5e3a;    /* Sunset Red */
  --cat-relaxing: #00f2fe;     /* Turquoise Cyan */
  --cat-culinary: #ffd000;     /* Gold Yellow */
  --cat-cultural: #b92bff;     /* Magenta Purple */
  
  /* Glassmorphism Details */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-border-focus: rgba(255, 255, 255, 0.2);
  --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --glass-blur: blur(12px);
  
  /* Typography */
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

input[type="text"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-secondary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* --- App Layout --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  background-color: var(--bg-primary);
}

/* --- Sidebar --- */
.sidebar {
  width: 380px;
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--glass-glow);
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform var(--transition-normal);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--accent-secondary);
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
  animation: float 3s ease-in-out infinite;
}

.app-header h1 {
  font-family: var(--font-family-heading);
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Navigation Tabs */
.sidebar-nav {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.nav-tab i {
  width: 18px;
  height: 18px;
}

.nav-tab span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.nav-tab.active {
  color: var(--accent-secondary);
  border-bottom-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.05);
}

/* Sidebar Scrollable Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  position: relative;
}

/* Hide scrollbar defaults */
.sidebar-content::-webkit-scrollbar {
  width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn var(--transition-normal);
}

.tab-panel.active {
  display: flex;
}

.panel-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge {
  background: var(--glass-border);
  color: #22d3ee; /* Light cyan for WCAG AAA compliance */
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

h3 {
  font-family: var(--font-family-heading);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.panel-section {
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 20px;
}

.panel-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-focus);
}

.stat-card.span-2 {
  grid-column: span 2;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-family-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, #fff 40%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Category Stats list --- */
.category-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.category-indicator {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

.category-indicator.adventure { background-color: var(--cat-adventure); box-shadow: 0 0 8px var(--cat-adventure); }
.category-indicator.relaxing { background-color: var(--cat-relaxing); box-shadow: 0 0 8px var(--cat-relaxing); }
.category-indicator.culinary { background-color: var(--cat-culinary); box-shadow: 0 0 8px var(--cat-culinary); }
.category-indicator.cultural { background-color: var(--cat-cultural); box-shadow: 0 0 8px var(--cat-cultural); }

.category-stat-name {
  flex: 1;
  text-transform: capitalize;
  color: var(--text-secondary);
}

.category-stat-count {
  font-weight: 600;
}

.category-stat-bar-container {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.category-stat-bar {
  height: 100%;
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-stat-bar.adventure { background-color: var(--cat-adventure); }
.category-stat-bar.relaxing { background-color: var(--cat-relaxing); }
.category-stat-bar.culinary { background-color: var(--cat-culinary); }
.category-stat-bar.cultural { background-color: var(--cat-cultural); }

/* --- Filters & Search --- */
.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  overflow: hidden;
}

.search-box {
  position: relative;
  width: 100%;
}

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

.search-box input {
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 10px 12px 10px 38px;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-row .form-group {
  min-width: 0;
}

/* Custom Select Dropdowns */
.custom-select {
  flex: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 10px;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.custom-select:focus {
  border-color: var(--accent-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.custom-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  user-select: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}

/* Full-width buttons should use flex (not inline-flex) for proper vertical centering */
.btn[style*="width: 100%"],
.btn[style*="width:100%"] {
  display: flex;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  gap: 4px;
}

.btn-primary {
  background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
  color: #030712;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
  font-weight: 600;
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border-focus);
}

.btn-danger {
  background: #fca5a5;
  color: #030712;
  font-weight: 600;
}

.btn-danger:hover {
  background: #fecaca;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger-link {
  background: none;
  border: none;
  color: #ff8a8a; /* High contrast coral red for WCAG AAA */
  font-size: 12px;
  font-weight: 500;
  padding: 8px 0;
  width: fit-content;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.btn-danger-link:hover {
  color: #ffb3b3;
  text-decoration: underline;
}

.import-export-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-buttons-row {
  display: flex;
  gap: 10px;
}

.action-buttons-row .btn {
  flex: 1;
}

/* --- Empty States --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  background: var(--glass-bg);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.empty-state i {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.5;
}

/* --- Memory List Cards --- */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.memory-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 4px;
  background: transparent;
  transition: background-color var(--transition-fast);
}

.memory-card.adventure::before { background-color: var(--cat-adventure); }
.memory-card.relaxing::before { background-color: var(--cat-relaxing); }
.memory-card.culinary::before { background-color: var(--cat-culinary); }
.memory-card.cultural::before { background-color: var(--cat-cultural); }

.memory-card:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border-focus);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.memory-card-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: var(--bg-secondary);
}

.memory-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* truncate text inside */
}

.memory-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.memory-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.memory-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.memory-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.memory-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.memory-card-tag {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.star-rating-mini {
  display: flex;
  gap: 2px;
  color: var(--accent-warning);
  font-size: 10px;
}

.star-rating-mini i {
  width: 10px;
  height: 10px;
  fill: currentColor;
}

/* --- Journey List Cards --- */
.journey-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journey-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all var(--transition-fast);
}

.journey-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border-focus);
}

.journey-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.journey-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journey-color-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px currentColor;
}

.journey-card h4 {
  font-family: var(--font-family-heading);
  font-size: 15px;
  font-weight: 600;
}

.journey-card-actions {
  display: flex;
  gap: 8px;
}

.journey-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

.journey-action-btn.delete:hover {
  color: var(--accent-danger);
}

.journey-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.journey-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 8px;
}

/* --- Main Content & Map Area --- */
.main-content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  position: relative;
  flex: 1;
  min-height: 0;
  background-color: var(--bg-primary);
  z-index: 1;
}

/* Floating Alerts on Map */
.floating-alert {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
  background: rgba(11, 19, 41, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  padding: 10px 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--glass-glow);
  pointer-events: none;
  font-size: 12px;
  font-weight: 500;
  animation: slideDown var(--transition-normal);
  border-left: 3px solid var(--accent-secondary);
}

.floating-alert i {
  color: var(--accent-secondary);
  width: 16px;
  height: 16px;
}

/* Customize Leaflet Styles */
.leaflet-container {
  font-family: var(--font-family-body) !important;
}

.leaflet-bar {
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-glow) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: rgba(11, 19, 41, 0.9) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--glass-border) !important;
  transition: background var(--transition-fast) !important;
}

.leaflet-bar a:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.leaflet-bar a.leaflet-disabled {
  background-color: rgba(11, 19, 41, 0.5) !important;
  color: var(--text-muted) !important;
}

/* Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
  background: rgba(11, 19, 41, 0.9) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--glass-glow) !important;
  border-radius: var(--radius-md) !important;
}

.leaflet-popup-tip {
  background: rgba(11, 19, 41, 0.9) !important;
  border: 1px solid var(--glass-border) !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-size: 13px !important;
}

/* Custom glowing pins */
.custom-map-marker {
  background: none;
  border: none;
}

.marker-pin-outer {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: translate(-10px, -10px);
}

.marker-pin-inner {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  z-index: 2;
  box-shadow: 0 0 10px currentColor;
}

.marker-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.4;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  z-index: 1;
}

/* --- Timeline Panel --- */
.timeline-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 380px; /* Offset by sidebar */
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  z-index: 5;
  transition: transform var(--transition-normal);
  height: 220px;
  display: flex;
  flex-direction: column;
}

/* Collapsed Timeline */
.timeline-panel.collapsed {
  transform: translateY(170px); /* Leave header visible */
}

.timeline-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-title i {
  color: var(--accent-secondary);
  width: 16px;
  height: 16px;
}

.timeline-title h2 {
  font-family: var(--font-family-heading);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.timeline-toggle-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.timeline-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.timeline-toggle-btn i {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.timeline-panel.collapsed #timeline-toggle-icon {
  transform: rotate(180deg);
}

/* Timeline scroll area */
.timeline-scroll-container {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 24px;
  position: relative;
  display: flex;
  align-items: center;
}

.timeline-scroll-container::-webkit-scrollbar {
  height: 6px;
}
.timeline-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}
.timeline-scroll-container::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}

.timeline-line {
  position: absolute;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0.3;
  z-index: 1;
}

.timeline-events {
  display: flex;
  gap: 60px;
  padding-left: 20px;
  padding-right: 40px;
  z-index: 2;
  position: relative;
}

.timeline-event {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 180px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.timeline-event:hover {
  transform: translateY(-4px);
}

.timeline-node {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 10px currentColor;
  z-index: 4;
  margin-bottom: 12px;
  transition: transform var(--transition-fast);
}

.timeline-event:hover .timeline-node {
  transform: scale(1.3);
}

.timeline-node.adventure { background-color: var(--cat-adventure); color: var(--cat-adventure); }
.timeline-node.relaxing { background-color: var(--cat-relaxing); color: var(--cat-relaxing); }
.timeline-node.culinary { background-color: var(--cat-culinary); color: var(--cat-culinary); }
.timeline-node.cultural { background-color: var(--cat-cultural); color: var(--cat-cultural); }

.timeline-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
  width: 100%;
  box-shadow: var(--glass-glow);
  transition: all var(--transition-fast);
}

.timeline-event:hover .timeline-card {
  border-color: var(--accent-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.timeline-card h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-card span {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Adjust timeline width when map shrinks */
@media (max-width: 1000px) {
  .timeline-panel {
    left: 0;
  }
}

/* --- Modals Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 100;
  display: none; /* Controlled dynamically */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: rgba(11, 19, 41, 0.95);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  transform: translateY(30px);
  transition: transform var(--transition-normal);
}

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

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

.modal-header h2 {
  font-family: var(--font-family-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* --- Forms Inside Modals --- */
.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-form input[type="text"],
.modal-form input[type="date"],
.modal-form input[type="datetime-local"],
.modal-form input[type="number"],
.modal-form input[type="password"],
.modal-form input[type="email"],
.modal-form select,
.modal-form textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.modal-form input[type="text"]:focus,
.modal-form input[type="date"]:focus,
.modal-form input[type="datetime-local"]:focus,
.modal-form input[type="number"]:focus,
.modal-form input[type="password"]:focus,
.modal-form input[type="email"]:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: var(--accent-secondary);
  background: rgba(255, 255, 255, 0.1);
}

/* Color Picker Custom Styles */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  width: fit-content;
}

.color-picker-wrapper input[type="color"] {
  border: none;
  background: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  outline: none;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
}

/* Star Rating Input */
.star-rating-input {
  display: flex;
  flex-direction: row-reverse; /* Reorder so peers can style with + selector */
  justify-content: flex-end;
  gap: 4px;
}

.star-rating-input input {
  display: none;
}

.star-rating-input label {
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.star-rating-input label i {
  width: 20px;
  height: 20px;
}

.star-rating-input input:checked ~ label,
.star-rating-input label:hover,
.star-rating-input label:hover ~ label {
  color: var(--accent-warning);
}

.star-rating-input label:hover i,
.star-rating-input label:hover ~ label i,
.star-rating-input input:checked ~ label i {
  fill: currentColor;
}

/* --- Image Selector in Form --- */
.image-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.image-option {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.image-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-option:hover {
  transform: scale(1.05);
}

.image-option.selected {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.image-option.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent-secondary);
  color: white;
  font-size: 10px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* --- Detail Modal (Special Card) --- */
.detail-card {
  max-width: 900px !important;
  width: 95% !important;
  display: flex;
  flex-direction: row;
  height: 80vh;
  position: relative;
  overflow: hidden !important;
  overflow-y: hidden !important;
}

.detail-viewer-left {
  position: relative;
  flex: 1.2;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.detail-viewer-right {
  overflow-y: auto;
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
}

.detail-hero {
  height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 24px;
}

.detail-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(11, 19, 41, 0.98), rgba(0, 0, 0, 0.2));
}

.close-btn-light {
  position: absolute;
  top: 16px;
  right: 20px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 28px;
  z-index: 5;
}

.close-btn-light:hover {
  color: white;
}

.detail-category-badge {
  position: relative;
  z-index: 2;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-category-badge.adventure { background-color: #ff9e80; color: #0b1329; }
.detail-category-badge.relaxing { background-color: var(--cat-relaxing); color: #0b1329; }
.detail-category-badge.culinary { background-color: var(--cat-culinary); color: #0b1329; }
.detail-category-badge.cultural { background-color: #d8b4fe; color: #0b1329; }

.detail-body {
  padding: 24px;
}

.detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-date {
  font-size: 12px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-date i {
  width: 14px;
  height: 14px;
}

.star-rating-display {
  display: flex;
  gap: 4px;
  color: var(--accent-warning);
}

.star-rating-display i {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.star-rating-display i.empty {
  color: var(--text-muted);
  fill: none;
}

.detail-title {
  font-family: var(--font-family-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.detail-journey {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.journey-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-weight: 500;
}

.detail-description-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.detail-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-coords {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.detail-coords i {
  width: 12px;
  height: 12px;
}

.detail-actions {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.detail-actions .btn {
  flex: 1;
}

/* --- KEYFRAME ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0; }
  50% { opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* --- Responsive Adaptations --- */
/* --- Mobile Sidebar Toggle & Backdrop --- */
.btn-mobile-sidebar-toggle {
  display: none;
  background: rgba(11, 19, 41, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 12px;
  transition: all var(--transition-fast);
}

.btn-mobile-sidebar-toggle:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-secondary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal) ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: rgba(11, 19, 41, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-border);
  z-index: 1002;
  justify-content: space-around;
  align-items: center;
  padding: 6px 12px 10px 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast) ease, transform var(--transition-fast) ease;
  flex: 1;
  padding: 4px 0;
  text-decoration: none;
  outline: none;
}

.mobile-nav-btn i, .mobile-nav-btn svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast) ease;
}

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

.mobile-nav-btn.active {
  color: var(--accent-secondary) !important;
}

.mobile-nav-btn.active i, .mobile-nav-btn.active svg {
  transform: scale(1.1);
}

/* --- Responsive Adaptations (Tablet & Mobile Drawer) --- */
@media (max-width: 1024px) {
  .btn-mobile-sidebar-toggle {
    display: flex !important;
  }
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 300px !important;
    height: 100vh !important;
    z-index: 2000 !important;
    transform: translateX(-100%);
    transition: transform var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.6) !important;
  }
  .sidebar.mobile-active {
    transform: translateX(0) !important;
  }
  .sidebar-backdrop {
    display: block !important;
  }
  .desktop-only-text {
    display: none !important;
  }
  .app-container {
    flex-direction: row !important;
  }
}

/* --- Responsive Adaptations (Mobile Specifics) --- */
@media (max-width: 900px) {
  .detail-card {
    flex-direction: column !important;
    height: 90vh !important;
    width: 95% !important;
  }
  .detail-viewer-left {
    flex: none !important;
    height: 35% !important;
    width: 100% !important;
  }
  .detail-viewer-right {
    flex: 1 !important;
    padding: 16px !important;
    width: 100% !important;
    overflow-y: auto !important;
  }
}

@media (max-width: 768px) {
  .view-switcher {
    display: none !important;
  }
  
  .mobile-bottom-nav {
    display: flex !important;
  }
  
  .view-content-wrapper {
    height: calc(100vh - 70px - 64px) !important;
  }
  
  .map-bottom-controls-wrapper {
    bottom: 20px !important;
    left: 10px !important;
    right: 10px !important;
  }
  
  /* Horizontally Scrollable Timeline Nodes - Prevents horizontal page break */
  .map-timeline-bar-nodes {
    overflow-x: auto !important;
    justify-content: flex-start !important;
    scrollbar-width: none !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 24px !important;
    padding: 10px 16px !important;
  }
  .map-timeline-bar-nodes::-webkit-scrollbar {
    display: none !important;
  }
  .map-timeline-node {
    flex: 0 0 auto !important;
    width: 70px !important;
  }
  .map-timeline-line {
    width: 100% !important;
    min-width: 800px !important;
    right: auto !important;
  }
  
  .diary-book-wrapper {
    padding: 20px !important;
  }
  
  /* Scale header elements on mobile to prevent wrapping */
  .main-header-bar {
    padding: 10px 12px !important;
    height: 60px !important;
  }
  #active-map-selector {
    width: 130px !important;
    font-size: 14px !important;
  }
  #active-map-privacy-badge {
    padding: 2px 6px !important;
    font-size: 10px !important;
  }
  .header-left {
    gap: 6px !important;
  }
  .header-right {
    gap: 8px !important;
  }
}

@media (max-width: 500px) {
  .modal-card {
    max-width: 95% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
}

@media (max-width: 400px) {
  #active-map-privacy-badge {
    display: none !important;
  }
  #active-map-selector {
    width: 110px !important;
  }
}

@media (max-width: 480px) {
  .gallery-grid.comfortable {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 12px !important;
  }
  .gallery-grid.dense {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
    gap: 8px !important;
  }
}

/* ==========================================================================
   MemMap - Extended Full-Stack Component Styles
   ========================================================================== */

/* --- Main Header Bar --- */
.main-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-glow);
  position: relative;
  z-index: 10000;
  height: 70px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- View Switcher --- */
.view-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.view-btn {
  background: none;
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* Active view tab — uses dark text on light accent for WCAG AAA (contrast ~10:1) */
.view-btn.active {
  background: var(--accent-primary);
  color: #030712;  /* Near-black — contrast ~10:1 against #c084fc (AAA) */
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(192, 132, 252, 0.4);
}

/* --- View Panels --- */
.view-content-wrapper {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.view-panel {
  display: none;
  width: 100%;
  position: relative;
}

.view-panel.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Map panel: position:relative so absolute overlays (timeline, gallery, alerts) anchor to it */
#view-panel-map {
  position: relative;
  overflow: hidden;
}

#view-panel-gallery.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- User Dropdown --- */
.user-dropdown-container {
  position: relative;
}

.user-menu-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.user-menu-btn:hover {
  border-color: var(--glass-border-focus);
  background: rgba(255, 255, 255, 0.08);
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-glow);
  width: 180px;
  z-index: 100;
  overflow: hidden;
}

.user-dropdown-menu.active {
  display: block;
}

.user-dropdown-menu button,
.user-dropdown-menu a {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-dropdown-menu button:hover,
.user-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* --- Upload Progress Panel --- */
.upload-progress-panel {
  position: absolute;
  top: 20px;
  left: 20px;   /* Left side — clear of the right-aligned map control buttons */
  z-index: 1001;
  background: rgba(11, 19, 41, 0.96);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-glow);
  width: 320px;
  animation: slideDown var(--transition-normal);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  width: 0%;
  transition: width 0.1s linear;
}

/* --- Map List Styling --- */
.map-item-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.map-item-card:hover {
  border-color: var(--accent-secondary);
  background: rgba(255, 255, 255, 0.06);
}

.map-item-card.active {
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.05);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.map-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.map-card-header h4 {
  font-family: var(--font-family-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.map-card-stats {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.map-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}

/* --- Timeline Drill-down --- */
.timeline-drilldown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.timeline-drilldown-header h2 {
  font-family: var(--font-family-heading);
  font-size: 22px;
  font-weight: 700;
}

.timeline-breadcrumbs {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  display: flex;
  gap: 6px;
}

.timeline-breadcrumbs span {
  cursor: pointer;
}

.timeline-breadcrumbs span:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.timeline-breadcrumbs span:last-child {
  color: var(--text-muted);
  cursor: default;
  text-decoration: none;
}

.timeline-density-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  border-bottom: 2px solid var(--glass-border);
  padding-bottom: 8px;
  margin-bottom: 30px;
}

.timeline-bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.timeline-bar-fill {
  width: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
  min-height: 2px;
}

.timeline-bar-column:hover .timeline-bar-fill {
  background: var(--accent-secondary);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.timeline-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

.timeline-nodes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-node-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeline-node-card:hover {
  border-color: var(--glass-border-focus);
  background: rgba(255, 255, 255, 0.05);
}

.timeline-node-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-node-info {
  flex: 1;
}

.timeline-node-info h4 {
  font-family: var(--font-family-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-node-count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Gallery Layouts --- */
.gallery-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: sticky;
  top: -20px;
  z-index: 10;
  background: var(--bg-primary);
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
}

/* --- Collapsible Details/Summary Styling --- */
.sidebar-details {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.01);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.sidebar-details[open] {
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-summary {
  padding: 12px 16px;
  cursor: pointer;
  outline: none;
  user-select: none;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none; /* Hide default arrow */
}

.sidebar-summary::-webkit-details-marker {
  display: none; /* Hide default Safari arrow */
}

.sidebar-summary::after {
  content: '\25BC'; /* Down arrow */
  font-size: 10px;
  color: var(--accent-secondary);
  transition: transform var(--transition-normal);
}

.sidebar-details[open] .sidebar-summary::after {
  transform: rotate(-180deg);
}

.sidebar-details-content {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-grid {
  display: grid;
  gap: 20px;
  transition: all var(--transition-normal);
}

.gallery-grid.comfortable {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.gallery-grid.dense {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.gallery-item-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.gallery-item-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-focus);
}

.gallery-item-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 Aspect Ratio */
  background: var(--bg-secondary);
}

.gallery-item-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.gallery-item-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-grid.dense .gallery-item-info {
  display: none;
}

.gallery-item-info h4 {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Diary Book View --- */
.diary-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.diary-header {
  text-align: center;
  margin-bottom: 40px;
}

.diary-header h2 {
  font-family: var(--font-family-heading);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
}

.diary-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.diary-notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.diary-note-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
}

.diary-note-item p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.diary-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.diary-timeline-scroller {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid var(--glass-border);
}

.diary-timeline-item {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  gap: 24px;
}

.diary-timeline-item::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  border: 2px solid var(--bg-primary);
}

.diary-timeline-left {
  flex: 1.2;
}

.diary-timeline-right {
  flex: 0.8;
}

.diary-timeline-left h4 {
  font-family: var(--font-family-heading);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.diary-timeline-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.diary-timeline-media {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  max-height: 220px;
  object-fit: cover;
  cursor: pointer;
}

/* --- Media Detail Carousel --- */
.detail-viewer-left {
  flex: 1.2;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.detail-viewer-right {
  flex: 0.8;
  background: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
}

.detail-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide-content img,
.carousel-slide-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.carousel-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.carousel-nav-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

.carousel-nav-btn.prev { left: 16px; }
.carousel-nav-btn.next { right: 16px; }

.tag-suggestions-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-suggest-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag-suggest-badge:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #030712;
}

/* --- Admin Queue Log rows --- */
.admin-job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 11px;
}

.admin-job-row:last-child {
  border-bottom: none;
}

.admin-job-badge {
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
}

.admin-job-badge.pending { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.admin-job-badge.processing { background: rgba(6, 182, 212, 0.1); color: var(--accent-secondary); }
.admin-job-badge.completed { background: rgba(16, 185, 129, 0.1); color: var(--accent-success); }
.admin-job-badge.failed { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }

button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
textarea:focus-visible {
  outline: 2px solid var(--accent-secondary) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   MemMap - Custom Upgrades & Extended UI Styles
   ========================================================================== */

/* --- Collapsible Sidebar Styles --- */
.sidebar {
  transition: width var(--transition-normal), transform var(--transition-normal);
}

.sidebar.shrunk {
  width: 68px !important;
}

.sidebar.shrunk .logo-text,
.sidebar.shrunk .tagline,
.sidebar.shrunk .nav-tab span,
.sidebar.shrunk .sidebar-content,
.sidebar.shrunk .sidebar-footer {
  display: none !important;
}

.sidebar.shrunk .sidebar-nav {
  flex-direction: column;
}

.sidebar.shrunk .nav-tab {
  padding: 16px 0;
  border-bottom: none;
  border-left: 3px solid transparent;
  width: 100%;
}

.sidebar.shrunk .nav-tab.active {
  border-left-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.08);
}

.sidebar.shrunk .app-header {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 96px;
  box-sizing: border-box;
}

.sidebar.shrunk .logo-area {
  justify-content: center;
  gap: 0;
}

/* Sidebar toggle button — inline in header flow */
.sidebar-toggle-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Position relative to header, not absolute */
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  z-index: 15;
}

.sidebar-toggle-btn:hover {
  background: var(--accent-secondary);
  color: var(--bg-sidebar);
  box-shadow: 0 0 12px var(--accent-secondary);
}

/* When sidebar is shrunk, button flows below the logo icon */
.sidebar.shrunk .sidebar-toggle-btn {
  position: static !important;
  transform: none !important;
  margin: 0 auto;
  flex-shrink: 0;
}

/* --- Map Timeline Bar --- */
.map-timeline-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(11, 19, 41, 0.9);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  z-index: 1000;
  box-shadow: var(--glass-glow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition-normal);
}

.map-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-timeline-title {
  font-family: var(--font-family-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.map-timeline-bar-nodes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding: 10px 0;
}

.map-timeline-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--glass-border);
  z-index: 1;
  transform: translateY(-50%);
}

.map-timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  cursor: pointer;
  position: relative;
}

.map-timeline-node-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid currentColor;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  transition: all var(--transition-fast);
}

.map-timeline-node-circle::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.map-timeline-node:hover .map-timeline-node-circle,
.map-timeline-node.active .map-timeline-node-circle {
  transform: scale(1.25);
  box-shadow: 0 0 12px currentColor;
}

.map-timeline-node-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.map-timeline-node-count {
  font-size: 8px;
  color: var(--text-muted);
}

/* --- Bottom Controls Wrapper --- */
.map-bottom-controls-wrapper {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 90px; /* leave space for Leaflet zoom controls at bottom-right */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  transition: all var(--transition-normal);
}

.map-bottom-controls-wrapper > * {
  pointer-events: auto;
}

.map-timeline-container,
.map-gallery-container {
  position: static !important;
  width: 100% !important;
  margin: 0 !important;
}

/* --- Collapsible Bottom Map Gallery --- */
.map-gallery-container {
  background: rgba(11, 19, 41, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-glow);
  display: flex;
  flex-direction: column;
  height: 250px;
  max-height: 250px;
  transition: all var(--transition-normal);
}

.map-gallery-container.collapsed {
  height: 40px;
  max-height: 40px;
}

.map-gallery-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  height: 40px;
  min-height: 40px;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.map-gallery-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-secondary);
}

.map-gallery-content {
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  flex: 1;
  min-height: 0;
  align-content: start;
}

.map-gallery-content.collapsed {
  display: none !important;
}

/* --- Mini Gallery: override full-gallery card styles --- */
.map-gallery-content.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
  gap: 10px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.map-gallery-content .gallery-item-card {
  width: 100% !important;
  min-width: 0 !important;
  height: 110px !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

.map-gallery-content .gallery-item-card:hover {
  transform: translateY(-2px);
}

.map-gallery-content .gallery-item-img-wrapper {
  height: 80px !important;
  padding-top: 0 !important;
  position: relative !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: var(--bg-secondary) !important;
}

.map-gallery-content .gallery-item-img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.map-gallery-content .gallery-item-info {
  padding: 4px 6px !important;
  height: 30px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
}

.map-gallery-content .gallery-item-info h4 {
  font-size: 10px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
  width: 100% !important;
}

.map-gallery-content .gallery-item-info .gallery-item-filename,
.map-gallery-content .gallery-item-info .gallery-item-date {
  font-size: 9px !important;
}

/* Hide location, date, filename lines in mini gallery to save space */
.map-gallery-content .gallery-item-info > div {
  display: none !important;
}

.map-gallery-content .gallery-item-checkbox {
  width: 14px !important;
  height: 14px !important;
  top: 6px !important;
  left: 6px !important;
}

/* Mini gallery scrollbar styling */
.map-gallery-content::-webkit-scrollbar {
  width: 6px;
}
.map-gallery-content::-webkit-scrollbar-track {
  background: transparent;
}
.map-gallery-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}
.map-gallery-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Full Screen Map --- */
.fullscreen-map #map {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
}

.fullscreen-map .map-timeline-container {
  z-index: 100000 !important;
  position: fixed !important;
  bottom: 20px !important;
}

.fullscreen-map .map-gallery-container {
  z-index: 100000 !important;
  position: fixed !important;
  bottom: 150px !important;
}

.btn-fullscreen-map {
  /* Positioned by parent container */
}

/* --- Word Cloud --- */
.word-cloud-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.word-cloud-item {
  display: inline-block;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.word-cloud-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* --- Reusable Gallery Grid Elements --- */
.gallery-item-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: all var(--transition-normal);
}

.gallery-item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glass-glow);
}

.gallery-item-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* --- Timeline Views Layout toggles --- */
.timeline-density-chart.horizontal {
  display: flex;
  align-items: flex-end;
  height: 120px;
  gap: 4px;
}

.timeline-density-chart.vertical {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: auto;
  gap: 4px;
  padding-left: 20px;
}

.timeline-nodes-list.horizontal {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 16px;
  padding: 20px 0;
}

.timeline-nodes-list.vertical {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
}

/* --- Diary Paginated Layout --- */
.diary-book-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
  min-height: 500px;
  box-shadow: var(--glass-glow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.diary-page-content {
  flex: 1;
}

.diary-page-header {
  border-bottom: 2px solid var(--accent-secondary);
  padding-bottom: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.diary-page-date {
  font-family: var(--font-family-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.diary-page-day {
  font-size: 14px;
  color: var(--accent-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.diary-page-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.diary-mini-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.diary-mini-gallery img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
}

.diary-mini-gallery img:hover {
  transform: scale(1.05);
  border-color: var(--accent-secondary);
}

.diary-pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
}

/* --- Welcoming Landing Page Styles --- */
.landing-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  overflow: hidden;
}

.landing-left {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px;
  padding-right: 500px;
  background: linear-gradient(135deg, rgba(11, 19, 41, 0.95) 0%, rgba(6, 182, 212, 0.05) 100%);
  position: relative;
}

.landing-left::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background-image: url('assets/mountains.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.04;
  z-index: -1;
}

.landing-right {
  position: absolute;
  top: 40px;
  right: 40px;
  width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(11, 19, 41, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-glow);
  z-index: 10;
}

.landing-tagline {
  font-family: var(--font-family-heading);
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
}

.landing-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}

.feature-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-box i {
  color: var(--accent-secondary);
  width: 24px;
  height: 24px;
}

.feature-box h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.feature-box p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.landing-footer {
  position: absolute;
  bottom: 24px;
  left: 80px;
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  body {
    overflow-y: auto !important;
    height: auto !important;
  }
  .landing-container {
    height: auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  .landing-left {
    padding: 40px 24px;
    padding-right: 24px;
    height: auto;
    min-height: auto;
  }
  .landing-right {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    border-radius: 0;
    padding: 40px 24px;
    box-shadow: none;
  }
  .landing-footer {
    position: static;
    margin-top: 40px;
    left: auto;
    padding-left: 24px;
    padding-bottom: 24px;
  }
}

/* --- Map Layers Panel --- */
.map-layers-panel {
  position: absolute;
  top: 80px;
  right: -320px;
  width: 280px;
  background: rgba(11, 19, 41, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-glow);
  z-index: 1005;
  transition: right var(--transition-normal);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-layers-panel.active {
  right: 20px;
}

.map-layers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}

.map-layers-title {
  font-family: var(--font-family-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-secondary);
}

.map-layers-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.layer-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
}

.layer-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border-focus);
}

.layer-card.active {
  border-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.1);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.layer-card-preview {
  height: 50px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.layer-card-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}


/* --- Date Picker Wrapper --- */
.date-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.date-input-wrapper input[type="date"] {
  width: 100%;
  min-width: 0;
  padding-right: 36px;
  box-sizing: border-box;
}

.btn-datepicker-trigger {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-datepicker-trigger:hover {
  color: var(--accent-secondary);
}

/* Persistent Copyright Notice */
.global-footer-notice {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 10002;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  font-family: var(--font-family-body);
}

/* --- Map Layer Section Labels --- */
.layer-section-label {
  grid-column: 1 / -1;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-secondary);
  padding: 6px 0 2px 0;
  border-top: 1px solid var(--glass-border);
  margin-top: 4px;
}

.layer-section-label:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

/* --- Custom Cluster Marker Overrides ---
   Suppress Leaflet MarkerCluster default styling completely */
.memmap-cluster-wrapper {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.memmap-cluster-wrapper .memmap-cluster {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.memmap-cluster-wrapper .memmap-cluster:hover {
  transform: scale(1.12);
}

/* Override Leaflet's default .marker-cluster-* divs if they leak through */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: transparent !important;
  color: transparent !important;
}

/* ============================================================
   Map Overlay Control Buttons — always visible on any map tile
   ============================================================ */
#btn-map-layers-trigger,
#btn-map-fullscreen,
#btn-map-export-trigger {
  background: rgba(11, 19, 41, 0.92) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #e2e8f0 !important;
  border-radius: 10px !important;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
}

#btn-map-layers-trigger:hover,
#btn-map-fullscreen:hover,
#btn-map-export-trigger:hover {
  background: rgba(99, 102, 241, 0.85) !important;
  border-color: rgba(99, 102, 241, 0.7) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

#btn-map-layers-trigger svg,
#btn-map-fullscreen svg,
#btn-map-export-trigger svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Make the container for these buttons also have a compact, grouped look */
.map-overlay-btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Leaflet zoom control — dark glassy theme to match app */
.leaflet-control-zoom {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5) !important;
}

.leaflet-control-zoom a {
  background: rgba(11, 19, 41, 0.92) !important;
  backdrop-filter: blur(8px);
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
  font-weight: 300 !important;
  transition: background 0.15s;
}

.leaflet-control-zoom a:hover {
  background: rgba(99, 102, 241, 0.85) !important;
  color: #fff !important;
}

.leaflet-control-zoom-in {
  border-radius: 12px 12px 0 0 !important;
}

.leaflet-control-zoom-out {
  border-radius: 0 0 12px 12px !important;
}

/* ============================================================


/* --- Gallery Timeline Bar --- */
.gallery-timeline-bar {
  background: rgba(11, 19, 41, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* --- Spin Animation for Loader --- */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-icon, .spin-icon svg {
  animation: spin 1.5s linear infinite !important;
}

/* Disabled form controls styling */
input:disabled, select:disabled, textarea:disabled {
  color: var(--text-secondary) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  cursor: not-allowed !important;
  opacity: 0.65;
}

/* Badge style overrides */
.badge-private {
  background: rgba(6, 182, 212, 0.08) !important;
  color: #22d3ee !important; /* Light cyan */
  border: 1px solid rgba(6, 182, 212, 0.25) !important;
}

.badge-shared {
  background: rgba(249, 115, 22, 0.08) !important;
  color: #fb923c !important; /* Orange shade */
  border: 1px solid rgba(249, 115, 22, 0.25) !important;
}

/* Cover Image Gallery Selector */
.cover-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.4);
}

.cover-gallery-item {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-gallery-item:hover {
  border-color: rgba(6, 182, 212, 0.5);
  transform: scale(1.02);
}

.cover-gallery-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.cover-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-gallery-item-none {
  font-size: 11px;
  text-align: center;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: bold;
  padding: 4px;
}

/* Sidebar heading style overrides for accessibility compliance */
.sidebar h2 {
  font-family: var(--font-family-heading);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sidebar h3 {
  font-size: 12px;
  color: var(--accent-secondary);
  margin-top: 8px;
  text-transform: uppercase;
  font-weight: 600;
}

/* --- Lightbox Overlay --- */
.lightbox-overlay {
  background: rgba(3, 7, 18, 0.95);
  z-index: 1000000 !important; /* Higher than header (10000) and fullscreen map (100000) */
  outline: none;
}

.lightbox-overlay.active {
  display: flex !important;
  opacity: 1 !important;
}

.lightbox-media {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease-in-out;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2510;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.lightbox-nav-btn:hover, .lightbox-nav-btn:focus-visible {
  background: rgba(15, 23, 42, 0.95);
  border-color: var(--accent-primary);
  transform: translateY(-50%) scale(1.1);
  outline: none;
}

.lightbox-nav-btn.prev {
  left: 32px;
}

.lightbox-nav-btn.next {
  right: 32px;
}

.lightbox-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: #ffffff;
  border: 2px solid #000000;
  color: #000000;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2510;
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.lightbox-close-btn:hover, .lightbox-close-btn:focus-visible {
  background: #f1f5f9;
  border-color: #000000;
  transform: scale(1.1);
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Ensure helper class for screen readers exists */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Diary tab Cover & Inline Edit styles --- */
.diary-hero-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.hero-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
}

.diary-hero-wrapper:hover .hero-cover-overlay {
  opacity: 1;
  display: flex;
}

.btn-inline-edit {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.diary-hero-wrapper.diary-hero-placeholder {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(15, 23, 42, 0.6)) !important;
  border-bottom: 2px dashed var(--glass-border);
  height: 120px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diary-hero-wrapper.diary-hero-placeholder .hero-cover-overlay {
  display: flex !important;
  opacity: 1 !important;
  background: transparent !important;
}


