/* ============================================================
   Transportation Record — Design System & Styles
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Background & Surface */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-glass-border: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #e2e8f0;

  /* Transport Colors */
  --color-high-speed-rail: #4A90D9;
  --color-flight: #E8833A;
  --color-train: #6B8E23;
  --color-bus: #9B59B6;
  --color-metro: #1ABC9C;
  --color-ferry: #3498DB;
  --color-other: #95A5A6;

  /* Accents */
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-glow: rgba(102, 126, 234, 0.15);
  --primary-color: #7c3aed;
  --primary-color-hover: #8b5cf6;

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(255, 255, 255, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.1);

  /* Sizing */
  --panel-width: 420px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Title */
  --title-color: #667eea;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-border: rgba(0, 0, 0, 0.06);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #334155;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 0, 0, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.06);
  --accent-glow: rgba(102, 126, 234, 0.08);
  --primary-color: #4f46e5;
  --primary-color-hover: #4338ca;
  --title-color: #4f46e5;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --- Side Panel --- */
.side-panel {
  width: var(--panel-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--bg-glass-border);
  z-index: 1000;
  position: relative;
  flex-shrink: 0;
}

/* Panel Header */
.panel-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.panel-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--title-color);
  letter-spacing: -0.02em;
}

.panel-title .logo-icon {
  font-size: 24px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 4px;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: background var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.stat-chip:hover {
  background: rgba(255, 255, 255, 0.08);
}

.stat-chip .stat-value {
  color: var(--text-primary);
  font-weight: 600;
}

.stat-chip.active {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.3);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
}

.filter-chip.active {
  border-color: var(--filter-color, var(--border-active));
  background: var(--filter-bg, rgba(255, 255, 255, 0.08));
  color: var(--text-primary);
}

/* Trip List */
.trip-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 78px;
  scroll-behavior: smooth;
}

.trip-list::-webkit-scrollbar {
  width: 4px;
}

.trip-list::-webkit-scrollbar-track {
  background: transparent;
}

.trip-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.trip-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Trip Card */
.trip-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.trip-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--card-accent-color, var(--color-other));
  border-radius: 3px 0 0 3px;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.trip-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.trip-card:hover::before {
  opacity: 1;
}

.trip-card.active {
  border-color: var(--card-accent-color, var(--border-active));
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card-hover), 0 0 0 1px var(--card-accent-color);
}

.trip-card.active::before {
  opacity: 1;
  width: 4px;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 64px;
  margin-bottom: 10px;
}

.card-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--badge-bg, rgba(255, 255, 255, 0.06));
  color: var(--badge-color, var(--text-secondary));
  border: 1px solid var(--badge-border, transparent);
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  flex: 1;
  text-align: center;
}

/* Route Display */
.card-route {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.route-city {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.route-arrow {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 40px;
}

.route-arrow .arrow-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--card-accent-color, var(--text-muted)), transparent 50%, var(--card-accent-color, var(--text-muted)));
  opacity: 0.4;
}

.route-arrow .arrow-head {
  color: var(--card-accent-color, var(--text-muted));
  font-size: 12px;
  opacity: 0.6;
}

.route-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--card-accent-color, var(--text-secondary));
}

/* Card Time Row */
.card-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.time-point {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.time-point:last-child {
  align-items: flex-end;
}

.time-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.time-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.time-station {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-duration {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* Card Details (extra info) */
.card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 8px;
  border-radius: 6px;
}

.detail-tag .detail-icon {
  font-size: 11px;
  opacity: 0.7;
}

/* Stops (collapsible) */
.card-stops {
  margin-top: 8px;
}

.stops-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
  user-select: none;
}

.stops-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.stops-toggle .toggle-arrow {
  transition: transform var(--transition-fast);
  font-size: 10px;
}

.stops-toggle.expanded .toggle-arrow {
  transform: rotate(90deg);
}

.stops-list {
  display: none;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--border-subtle);
}

.stops-list.visible {
  display: block;
  animation: slideDown 0.25s ease;
}

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

.stop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.stop-item .stop-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--card-accent-color, var(--text-muted));
  opacity: 0.6;
  flex-shrink: 0;
}

.stop-item .stop-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}

/* Notes */
.card-notes {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Map Container --- */
.map-container {
  flex: 1;
  height: 100vh;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

/* Leaflet customization */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-card) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
  transition: all var(--transition-fast);
}

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

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

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

.leaflet-interactive:focus {
  outline: none !important;
}

.leaflet-control-attribution {
  background: rgba(10, 14, 23, 0.7) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  backdrop-filter: blur(8px);
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* Custom Popup */
.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
  backdrop-filter: blur(16px);
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-top: none !important;
  border-left: none !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  font-family: 'Inter', 'Noto Sans SC', sans-serif !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.popup-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

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

.popup-info span {
  display: block;
  padding: 2px 0;
}

/* Custom Markers */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast);
}

.custom-marker:hover {
  transform: scale(1.2);
}

.custom-marker.departure {
  background: #22c55e;
}

.custom-marker.arrival {
  background: #ef4444;
}

.custom-marker.stop {
  width: 18px;
  height: 18px;
  font-size: 8px;
  border-width: 1.5px;
  opacity: 0.85;
}

/* --- Toggle Panel Button (mobile) --- */
.panel-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  padding: 10px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  font-family: inherit;
}

.panel-toggle button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.panel-toggle button.active {
  color: var(--text-primary);
}

.panel-toggle:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card-hover);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column-reverse;
  }

  .side-panel {
    width: 100%;
    height: 45vh;
    border-right: none;
    border-top: 1px solid var(--bg-glass-border);
    transition: transform var(--transition-slow);
  }

  .side-panel.collapsed {
    transform: translateY(calc(100% - 56px));
  }

  .map-container {
    height: 55vh;
  }

  .panel-toggle {
    display: block;
  }

  :root {
    --panel-width: 100%;
  }
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 14px;
  line-height: 1.6;
}

/* --- Loading State --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-spinner .spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner .spinner-text {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Map Tile Filters --- */
.dark-tiles {
  filter: brightness(0.7) contrast(1.1) saturate(0.8) hue-rotate(180deg) invert(1);
}

.gentle-railway {
  filter: sepia(0.2) saturate(0.5) opacity(0.5);
}

/* ============================================================
   Floating Action Buttons
   ============================================================ */

.fab-group {
  display: none;
}

.fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  font-family: inherit;
  text-decoration: none;
  color: var(--text-primary);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-card-hover);
}

.fab-primary {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
}

.add-trip-btn {
  width: auto;
  border-radius: 26px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  animation: pulse-glow 2s infinite;
}

.add-trip-btn .add-icon {
  font-size: 18px;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
  100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.fab-secondary {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
}

.fab-secondary:hover {
  background: var(--bg-card-hover);
}

.panel-add-trip-btn {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  z-index: 5;
}

.panel-add-trip-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 28px var(--accent-glow);
}

/* Panel Header Actions */
.panel-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

/* ============================================================
   Add Trip Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card-hover);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.96);
  transition: transform var(--transition-base);
}

.modal-overlay.visible .modal-card {
  transform: translateY(0) scale(1);
}

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

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--title-color);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.modal-tab:hover {
  color: var(--text-secondary);
}

.modal-tab.active {
  color: var(--text-primary);
  border-bottom-color: #667eea;
}

/* Tab Content */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* AI Tab */
.ai-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.ai-textarea:focus {
  outline: none;
  border-color: #667eea;
}

.ai-textarea::placeholder {
  color: var(--text-muted);
}

.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 20px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.ai-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.ai-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.ai-error {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 13px;
}

.ai-error.visible {
  display: block;
}

/* AI Preview */
.ai-preview {
  display: none;
  margin-top: 16px;
  padding: 16px;
  background: rgba(102, 126, 234, 0.06);
  border: 1px solid rgba(102, 126, 234, 0.15);
  border-radius: var(--radius-md);
}

.ai-preview.visible {
  display: block;
  animation: slideDown 0.3s ease;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.preview-badge {
  font-weight: 600;
  font-size: 14px;
}

.preview-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.preview-route {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.preview-point {
  display: flex;
  flex-direction: column;
}

.preview-city {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.preview-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.preview-arrow {
  font-size: 20px;
  color: var(--text-muted);
}

.preview-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.preview-coords {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: monospace;
}

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

.btn-confirm, .btn-edit {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.btn-confirm {
  background: #22c55e;
  color: white;
}

.btn-confirm:hover {
  background: #16a34a;
}

.btn-edit {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-edit:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Manual Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 11px;
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
}

.form-group select:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

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

.date-input,
.country-code-input,
.currency-select {
  min-height: 36px;
}

.date-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.country-flag-img {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 0.35em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--border-subtle);
}

.form-group input[type="time"] {
  min-height: 36px;
  color-scheme: dark;
}

[data-theme="light"] .form-group input[type="time"] {
  color-scheme: light;
}

.date-picker-field {
  position: relative;
  display: flex;
  align-items: center;
}

.date-picker-field .date-input {
  width: 100%;
  padding-right: 38px;
}

.date-picker-btn {
  position: absolute;
  right: 4px;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.date-picker-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.native-date-picker {
  position: absolute;
  right: 4px;
  bottom: 0;
  width: 30px;
  height: 28px;
  opacity: 0;
  pointer-events: none;
}

.currency-select {
  background-color: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  border-radius: 9px;
}

.country-select {
  position: relative;
  min-height: 36px;
}

.country-select-trigger {
  width: 100%;
  min-height: 36px;
  padding: 9px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.country-select-current,
.country-select-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-select-current .country-flag-img,
.country-select-option .country-flag-img {
  margin-right: 0;
  margin-left: auto;
}

.country-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: none;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-card-hover);
  z-index: 2400;
}

.country-select.open .country-select-menu {
  display: block;
}

.country-select-option {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 8px 9px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.country-select-option:hover,
.country-select-option.selected {
  background: var(--bg-card-hover);
}

.form-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.form-submit {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 10px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

/* Leaflet Layer Control Dark Theme */
.leaflet-control-layers {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
  color: var(--text-primary) !important;
  backdrop-filter: blur(12px);
}

.leaflet-control-layers-toggle {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  width: 36px !important;
  height: 36px !important;
  transition: all 0.2s;
}

.leaflet-control-layers-toggle:hover {
  background-color: var(--bg-card-hover) !important;
}

.leaflet-control-layers-expanded {
  padding: 10px 14px !important;
}

.leaflet-control-layers label {
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 0 !important;
  cursor: pointer !important;
}

.leaflet-control-layers label:hover {
  color: var(--text-primary) !important;
}

.leaflet-control-layers-separator {
  border-color: var(--border-subtle) !important;
}

.leaflet-control-layers input[type="checkbox"] {
  accent-color: #667eea;
}

/* Export button in panel */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

.create-profile-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.create-profile-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

/* Top Navbar */
.top-navbar {
  height: 0;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: fixed;
  top: 14px;
  left: 0;
  width: 100%;
  z-index: 2100;
  justify-content: space-between;
  pointer-events: none;
}

.top-navbar-brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  pointer-events: auto;
}

.top-navbar-brand svg {
  width: 20px;
  height: 20px;
}

.top-navbar-home {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
  pointer-events: auto;
}

.top-navbar-home:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.top-navbar > div {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  pointer-events: auto;
}

/* Adjust main container for top nav */
.app-container, .summary-container {
  height: 100dvh;
}
.side-panel {
  position: fixed;
  top: 66px;
  left: 16px;
  bottom: 16px;
  height: calc(100dvh - 82px);
  max-height: calc(100dvh - 82px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  transition: transform var(--transition-slow), opacity var(--transition-base);
}
.map-container {
  width: 100%;
  height: 100dvh;
}
.side-panel.panel-closed,
.side-panel.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}
.panel-toggle {
  display: inline-flex;
  align-items: center;
  left: 16px;
  bottom: 18px;
  padding: 4px;
  transform: none;
}
.panel-toggle button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.panel-toggle button svg {
  display: block;
  margin: auto;
}
.panel-toggle button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px var(--accent-glow);
}
@media (max-width: 768px) {
  .app-container {
    display: block;
    min-height: 100dvh;
  }

  .map-container {
    height: 100dvh;
    min-height: 0;
  }

  .side-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(56dvh, 100dvh);
    min-height: 0;
    border-right: none;
    border-top: 1px solid var(--bg-glass-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.35);
    transition: height var(--transition-slow), transform var(--transition-slow);
    z-index: 1000;
  }

  .side-panel.panel-full {
    height: 100dvh;
    border-radius: 0;
    transform: translateY(0);
  }

  .side-panel.panel-half {
    height: min(56dvh, 100dvh);
    transform: translateY(0);
  }

  .side-panel.panel-closed,
  .side-panel.collapsed {
    transform: translateY(100%);
  }

  .panel-header {
    padding: 14px 16px 10px;
  }

  .panel-title {
    gap: 8px;
    margin-bottom: 0;
  }

  .panel-title h1 {
    font-size: 18px;
  }

  .panel-title svg {
    width: 20px;
    height: 20px;
  }

  .panel-subtitle,
  .panel-header-actions {
    display: none;
  }

  .stats-bar,
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 8px 12px;
    scrollbar-width: none;
  }

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

  .stat-chip,
  .filter-chip {
    flex: 0 0 auto;
  }

  .trip-list {
    padding: 10px 10px 86px;
  }

  .trip-card {
    padding: 12px;
    margin-bottom: 8px;
  }

  .trip-list.selection-mode .trip-card {
    padding-left: 36px;
  }

  .card-selection {
    top: 13px;
    left: 12px;
  }

  .card-route {
    gap: 6px;
  }

  .route-city {
    min-width: 0;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .route-name {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .time-station {
    max-width: 118px;
  }

  .panel-toggle {
    left: 12px;
    bottom: 14px;
    transform: none;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
  }

  .panel-toggle button {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 600;
  }

  .fab-group {
    display: none;
  }
}


/* ============================================================
   Landing & Login Page Styles
   ============================================================ */

/* Landing Page */
.landing-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  animation: fadeIn 0.8s ease-out;
}

.hero-content {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.hero-icon {
  font-size: 64px;
  margin-bottom: -12px;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.hero-content h1 {
  font-size: 48px;
  font-weight: 800;
  color: var(--title-color);
  letter-spacing: -0.03em;
  margin: 0;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
}

.enter-btn {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  color: white;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-base);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.enter-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 32px var(--accent-glow);
}

/* Login Page */
.login-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--title-color);
  margin-bottom: 8px;
}

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

.login-form {
  width: 100%;
  max-width: 400px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.6s ease-out;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}

.input-group input {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.input-group input:focus {
  outline: none;
  border-color: var(--title-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-btn {
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.login-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-footer {
  margin-top: 24px;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--text-primary);
}

.pw-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

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

/* Card action buttons */
.card-delete,
.card-edit {
  position: absolute;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 2;
}

.card-delete { right: 8px; }
.card-edit { right: 40px; }

.trip-card:hover .card-delete,
.trip-card:hover .card-edit {
  opacity: 1;
}

.card-delete:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
.card-edit:hover { background: rgba(102,126,234,0.15); color: #667eea; }

/* User Picker */
.user-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.user-avatar {
  font-size: 24px;
  line-height: 1;
}

.user-select {
  flex: 1;
  padding: 5px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 24px;
}

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

/* Password Modal */
.password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(12px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-card {
  width: 340px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
}

.password-card .pw-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.password-card .pw-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.password-card .pw-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.password-card input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  margin-bottom: 12px;
}

.password-card input:focus {
  outline: none;
  border-color: #667eea;
}

.password-card .pw-error {
  font-size: 12px;
  color: #ef4444;
  margin-bottom: 8px;
  display: none;
}

.password-card .pw-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 8px;
}

.password-card .pw-cancel {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* Light theme overrides for specific elements */
[data-theme="light"] .custom-marker {
  border-color: #334155;
}

[data-theme="light"] .leaflet-control-zoom a {
  background: #ffffff !important;
  color: #1e293b !important;
  border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="light"] .leaflet-control-attribution {
  background: rgba(255,255,255,0.8) !important;
  color: #64748b !important;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #1e293b !important;
  border-color: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] .leaflet-popup-tip {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] .leaflet-control-layers {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.08) !important;
  color: #1e293b !important;
}

[data-theme="light"] .leaflet-control-layers-toggle {
  background-color: #ffffff !important;
  border-color: rgba(0,0,0,0.1) !important;
}

/* Year tabs for annual summary */
.year-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.year-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.year-tab:hover {
  background: rgba(255,255,255,0.08);
}

.year-tab.active {
  background: rgba(102,126,234,0.15);
  border-color: rgba(102,126,234,0.3);
  color: var(--text-primary);
}


.login-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.create-profile-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.create-profile-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.profile-save-btn {
  width: 100%;
  padding: 10px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.profile-save-btn:hover {
  background: var(--primary-color-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.user-dropdown-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
}

.user-dropdown-item:hover {
  background: var(--bg-body);
}

.user-dropdown-item.dropdown-danger {
  color: #ff4757;
}

.user-dropdown-item.dropdown-danger:hover {
  background: rgba(255, 71, 87, 0.1);
}

/* Trip Checkbox */
.card-selection {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 10;
  display: none;
}

.trip-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.trip-list.selection-mode .card-selection {
  display: block;
}

.trip-list.selection-mode .trip-card {
  padding-left: 40px;
}

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

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-left: 1px solid var(--border-subtle);
  margin-left: 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  max-width: 180px;
}

.user-dropdown-avatar {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
}

.user-dropdown-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.user-dropdown-container:hover .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.user-dropdown-toggle:hover {
  background: var(--bg-card-hover);
}

.user-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 6px;
  z-index: 1000;
}

.user-dropdown-menu-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  backdrop-filter: blur(16px);
  padding: 6px 0;
  min-width: 150px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .user-dropdown-toggle {
    width: 42px;
    height: 34px;
    justify-content: center;
    gap: 0;
    padding: 0;
    border-left: none;
    margin-left: 0;
  }

  .user-dropdown-name,
  .user-dropdown-toggle svg {
    display: none;
  }
}
