/* Modern Dashboard Styles */

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

:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --secondary-color: #64748b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.dashboard-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.header-logo {
  max-width: 300px;
  height: auto;
  margin-bottom: 1.5rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.dashboard-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Map Section */
.map-section {
  margin-bottom: 2rem;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}

.map-container {
  width: 100%;
  height: 600px;
  position: relative;
  overflow: hidden;
}

.map-container > .mapboxgl-map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Tour Stops List */
.tour-stops-list {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-height: calc(100% - 60px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 6px rgba(0,0,0,0.1);
}

.tour-stops-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.tour-stops-list-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tour-stops-list-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.home-btn:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.close-stops-list {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
}

.close-stops-list:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.tour-stops-list-content {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
}

.tour-stop-item {
  padding: 0;
  margin: 0.5rem 0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tour-stop-item:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.tour-stop-item.active {
  border-color: #10b981;
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.tour-stop-image-container {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: var(--background);
}

.tour-stop-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.tour-stop-item:hover .tour-stop-image {
  transform: scale(1.05);
}

.tour-stop-number {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

.tour-stop-info {
  padding: 0.75rem 1rem;
}

.tour-stop-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.tour-stop-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.125rem;
}

.tour-stop-region {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.show-stops-list-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.show-stops-list-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

@media (max-width: 768px) {
  .tour-stops-list {
    width: 100%;
    max-height: 50vh;
    bottom: 60px;
    top: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* Tour Leg Details Bar (below map section) */
.tour-leg-details-bar {
  display: block;
  width: 100%;
  max-width: 1400px;
  margin: 1rem auto;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1.5rem;
  clear: both;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.tour-leg-details-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.tour-leg-details-main {
  flex: 1;
}

.tour-leg-details-name {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

.tour-leg-details-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tour-leg-details-separator {
  color: var(--border);
}

.tour-leg-details-date-range {
  font-weight: 500;
  color: var(--text-primary);
}

.tour-leg-details-event-count {
  color: var(--text-secondary);
}

.tour-leg-details-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tour-leg-details-actions {
  display: flex;
  gap: 0.5rem;
}

.toggle-controls-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-controls-btn:hover {
  background: var(--primary-dark);
}

/* Tour Leg Events Table (below map section) */
.tour-leg-events-table {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.tour-leg-events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.tour-leg-events-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tour-leg-events-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tour-leg-events-wrapper {
  overflow-x: auto;
}

.tour-leg-events-table .data-table {
  width: 100%;
  margin: 0;
  border: none;
}

.tour-leg-events-table .data-table thead {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}

.tour-leg-events-table .data-table th {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid var(--border);
  background: var(--background);
}

.tour-leg-events-table .data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.tour-leg-events-table .data-table tbody tr:hover {
  background: var(--background);
}

/* Transport dropdown styling */
.transport-dropdown {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.transport-dropdown:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.transport-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Current event row highlighting */
.current-event-row {
  background: rgba(59, 130, 246, 0.05) !important;
}

.current-event-row:hover {
  background: rgba(59, 130, 246, 0.1) !important;
}

/* Map Controls Panel (collapsible overlay) */
.map-controls-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-left: 2px solid var(--border);
  border-top: 2px solid var(--border);
  box-shadow: -4px -4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1002;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  border-top-left-radius: 12px;
}

.map-controls-panel.collapsed {
  transform: translateY(calc(100% - 32px));
  max-width: 150px;
}

.map-controls-panel.collapsed .map-controls-header {
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  min-height: 32px;
}

.map-controls-panel.collapsed .map-controls-header h4 {
  font-size: 0.6875rem;
  font-weight: 500;
}

.map-controls-panel.collapsed .map-controls-header .close-controls-btn {
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
}

.map-controls-panel.collapsed .map-controls-content {
  display: none;
}

.map-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--primary-color);
  color: white;
  min-height: 40px;
}

.map-controls-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.close-controls-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-controls-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.map-controls-content {
  padding: 1rem 1.5rem;
}

.map-controls-content .map-stats {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.map-controls-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.map-controls-right .dark-mode-btn,
.map-controls-right .fullscreen-btn {
  align-self: flex-start;
}

.map-controls-right .dark-mode-btn + .fullscreen-btn {
  margin-top: 0;
}

.map-controls-right .map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tour-leg-filter {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: white;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  min-width: 150px;
}

.tour-leg-filter:hover {
  border-color: var(--primary-color);
}

.tour-leg-filter:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tour-stops-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.tour-stops-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.legend-tour-stop {
  width: 24px;
  height: 24px;
  background: #10b981;
  border: 3px solid white;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Tour Stop Markers */
.tour-stop-marker {
  animation: tourStopPulse 2s infinite;
}

@keyframes tourStopPulse {
  0%, 100% {
    box-shadow: 0 3px 6px rgba(0,0,0,0.4), 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  50% {
    box-shadow: 0 3px 6px rgba(0,0,0,0.4), 0 0 0 8px rgba(16, 185, 129, 0);
  }
}

.map-stats {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.map-stats #map-count {
  color: var(--primary-color);
  font-weight: 700;
}

.map-legend {
  display: flex;
  gap: 1.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: var(--shadow);
}

.legend-stratcom {
  width: 20px;
  height: 20px;
  background: #f59e0b;
  border: 3px solid white;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.legend-famcom {
  background: #3b82f6;
}

/* Size-based marker styling */
.marker.size-small {
  opacity: 0.8;
}

.marker.size-medium {
  opacity: 0.9;
}

.marker.size-large {
  opacity: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4) !important;
}

.marker.size-very_large {
  opacity: 1;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5) !important;
  border-width: 3px !important;
}

/* Fullscreen Button */
.fullscreen-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.125rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fullscreen-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

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

.fullscreen-btn.fullscreen-active {
  background: #ef4444;
}

.fullscreen-btn.fullscreen-active:hover {
  background: #dc2626;
}

.fullscreen-icon,
.fullscreen-icon-exit {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 1.25rem;
  line-height: 1;
}

/* Dark Mode Button */
.dark-mode-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.125rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dark-mode-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.dark-mode-btn:active {
  transform: translateY(0);
}

.dark-mode-icon,
.light-mode-icon {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 1.25rem;
  line-height: 1;
}

/* Tour Colors Button */
.tour-colors-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.tour-colors-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.tour-colors-btn:active {
  transform: translateY(0);
}

.tour-colors-btn.active {
  background: #DC2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.tour-colors-btn.active:hover {
  background: #B91C1C;
}

/* Fullscreen styles */
body.map-fullscreen {
  overflow: hidden;
  background: #000; /* Black background to match map */
}

body.map-fullscreen .dashboard-container {
  background: transparent;
}

.map-section.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #000; /* Black background to match map */
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.map-section.fullscreen .map-container {
  flex: 1;
  height: calc(100vh - 180px); /* Account for tour legs sidebar (~180px) */
  min-height: 0; /* Allow flex to work properly */
}

.map-section.fullscreen .tour-leg-details-bar {
  display: none; /* Hide details bar in fullscreen */
}

.map-section.fullscreen .tour-stops-list {
  max-height: calc(100vh - 60px);
  height: calc(100vh - 60px);
  z-index: 10001;
}

/* Tour Legs Sidebar in fullscreen - sidebar is outside map-section, so use body class */
body.map-fullscreen .tour-legs-sidebar {
  max-width: 100%;
  width: 100%;
  margin: 0 auto 1rem auto;
  z-index: 10000;
  display: flex !important; /* Force display */
  max-height: 180px !important; /* Override collapsed state */
  opacity: 1 !important; /* Override collapsed opacity */
}

/* Pulse animation for STRATCOM markers */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* Table Section */
.table-section {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Tab Navigation */
.tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--background);
  padding: 0 1.5rem;
}

.tab-button {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-button:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--surface);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Calendar tab specific styling */
#calendar-tab {
  overflow-y: auto;
  overflow-x: visible;
  max-height: calc(100vh - 200px);
  padding-bottom: 2rem;
  width: 100%;
  box-sizing: border-box;
}

/* Charts Styles */
.charts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.charts-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.chart-type-select,
.chart-sort-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}

.chart-limit {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  width: 100px;
  background: var(--surface);
  color: var(--text-primary);
}

.chart-container {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
  height: 600px;
  position: relative;
  transition: all 0.3s ease;
}

.chart-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  border-radius: 0;
  margin: 0;
  padding: 2rem;
  background: var(--background);
}

.chart-container.fullscreen canvas {
  max-height: calc(100vh - 120px);
}

@media (max-width: 768px) {
  .charts-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .chart-controls {
    flex-direction: column;
  }
  
  .chart-limit {
    width: 100%;
  }
  
  .chart-container {
    height: 400px;
    padding: 1rem;
  }
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.table-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.table-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-input,
.region-filter,
.type-filter {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
  transition: all 0.2s;
}

.search-input {
  min-width: 250px;
}

.search-input:focus,
.region-filter:focus,
.type-filter:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.region-filter,
.type-filter {
  min-width: 150px;
  cursor: pointer;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--background);
}

.data-table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.data-table tbody tr:hover {
  background: var(--background);
}

.data-table tbody tr.hidden {
  display: none;
}

.data-table td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* Address column - allow wrapping */
#schedule-table td:nth-child(5) {
  white-space: normal;
  word-wrap: break-word;
  max-width: 250px;
  line-height: 1.5;
}

/* Details column - allow wrapping */
#schedule-table td:nth-child(6) {
  white-space: normal;
  word-wrap: break-word;
  max-width: 400px;
  line-height: 1.5;
}

/* Notes column - allow wrapping */
#schedule-table td:nth-child(7) {
  white-space: normal;
  word-wrap: break-word;
  max-width: 400px;
  line-height: 1.5;
}

.community-details-inline {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.community-details-inline > div {
  margin-top: 0.25rem;
}

.community-details-inline > div:first-child {
  margin-top: 0;
}

.data-table td:first-child {
  font-weight: 600;
  color: var(--primary-color);
}

/* Schedule table specific styles */
#schedule-table td:first-child {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.8125rem;
}

.schedule-date {
  font-weight: 600;
  color: var(--text-primary);
}

.editable-cell {
  transition: background-color 0.2s;
}

.editable-cell:hover {
  background-color: #f8fafc;
}

.editable-cell .edit-icon {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  pointer-events: none;
}

.schedule-day {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.types-cell {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.type-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-famcom {
  background: #dbeafe;
  color: #1e40af;
}

.type-stratcom {
  background: #fef3c7;
  color: #92400e;
}

.type-community {
  background: #dcfce7;
  color: #166534;
}

.type-event {
  background: #fce7f3;
  color: #9f1239;
}

.month-filter {
  min-width: 150px;
  cursor: pointer;
}

/* Edit Button */
.edit-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.edit-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.edit-button:active {
  transform: translateY(0);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

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

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

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

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

.modal-content form {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: all 0.2s;
  font-family: inherit;
}

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

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.form-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.modal-body {
  padding: 1.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--background);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--primary-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-primary,
.btn-secondary {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

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

.btn-secondary:hover {
  background: var(--surface);
}

.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #dc2626;
}

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

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

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .edit-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
  }
}

.communities-table .coordinates {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Stats Panel */
.stats-panel {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1rem;
  background: var(--background);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.table-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--background);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.table-info span {
  font-weight: 600;
  color: var(--text-primary);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.export-btn {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.export-btn:hover {
  background: var(--primary-dark);
}

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

/* Mapbox Popup Customization */
.mapboxgl-popup-content {
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.mapboxgl-popup-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.mapboxgl-popup-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.25rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Mobile: Reduce padding */
  .dashboard-container {
    padding: 1rem;
  }
  
  /* Mobile: Smaller header */
  .dashboard-header h1 {
    font-size: 1.75rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  /* Mobile: Make tables horizontally scrollable */
  .table-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table {
    min-width: 800px; /* Ensure table doesn't shrink too much */
    font-size: 0.8125rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  /* Mobile: Smaller calendar */
  .calendar-container {
    padding: 0.5rem;
  }
  
  .calendar-month-title {
    font-size: 1rem;
    padding: 0.5rem;
  }
  
  .calendar-day {
    min-height: 60px;
    padding: 0.25rem;
  }
  
  .calendar-day-number {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
  }
  
  .calendar-event {
    font-size: 0.6875rem;
    padding: 0.375rem 0.5rem;
    line-height: 1.3;
  }
  
  .calendar-day-header {
    font-size: 0.6875rem;
    padding: 0.5rem 0.125rem;
  }
  
  .calendar-grid {
    gap: 0.25rem;
  }
  
  /* Mobile: Stack calendar controls */
  .calendar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .calendar-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .calendar-controls > * {
    width: 100%;
  }
  
  /* Mobile: Smaller tabs */
  .tabs-nav {
    padding: 0 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    white-space: nowrap;
  }
  
  /* Mobile: Smaller map */
  .map-container {
    height: 400px;
  }
  
  /* Mobile: Tour stops list overlay */
  .tour-stops-list {
    width: 100%;
    max-width: 100%;
    position: relative;
    max-height: 300px;
  }
  
  /* Mobile: Filter controls stack */
  .filter-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-controls > * {
    width: 100%;
  }
  
  /* Mobile: Smaller buttons */
  .btn-primary,
  .btn-secondary {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  /* Mobile: Better spacing for tour leg events table */
  .tour-leg-events-table {
    margin-bottom: 1rem;
  }
  
  .tour-leg-events-table .data-table {
    font-size: 0.75rem;
  }
  
  .tour-leg-events-table th,
  .tour-leg-events-table td {
    padding: 0.5rem 0.375rem;
    font-size: 0.75rem;
  }
  
  /* Mobile: Date and community tags smaller */
  .date-tag,
  .community-tag {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.5rem;
  }
  
  /* Mobile: Calendar 4-month container spacing */
  .calendar-4month-container {
    gap: 1rem;
  }
  
  /* Mobile: Hide some less important columns in schedule table */
  #schedule-table th:nth-child(n+8),
  #schedule-table td:nth-child(n+8) {
    display: none;
  }
  
  /* Mobile: Show essential columns only */
  #schedule-table th:nth-child(1),
  #schedule-table td:nth-child(1),
  #schedule-table th:nth-child(2),
  #schedule-table td:nth-child(2),
  #schedule-table th:nth-child(3),
  #schedule-table td:nth-child(3),
  #schedule-table th:nth-child(4),
  #schedule-table td:nth-child(4),
  #schedule-table th:nth-child(5),
  #schedule-table td:nth-child(5) {
    display: table-cell;
  }
}

@media (max-width: 480px) {
  .dashboard-container {
    padding: 1rem;
  }

  .header-logo {
    max-width: 200px;
    margin-bottom: 1rem;
  }

  .dashboard-header h1 {
    font-size: 2rem;
  }

  .map-container {
    height: 400px;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .table-controls {
    width: 100%;
  }

  .search-input,
  .region-filter {
    width: 100%;
  }

  .data-table {
    font-size: 0.75rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 1rem;
  }

  /* Hide columns on mobile for communities table */
  #communities-table th:nth-child(4),
  #communities-table td:nth-child(4),
  #communities-table th:nth-child(5),
  #communities-table td:nth-child(5),
  #communities-table th:nth-child(6),
  #communities-table td:nth-child(6),
  #communities-table th:nth-child(7),
  #communities-table td:nth-child(7),
  #communities-table th:nth-child(8),
  #communities-table td:nth-child(8) {
    display: none;
  }

  /* Hide columns on mobile for schedule table */
  #schedule-table th:nth-child(5),
  #schedule-table td:nth-child(5),
  #schedule-table th:nth-child(6),
  #schedule-table td:nth-child(6),
  #schedule-table th:nth-child(7),
  #schedule-table td:nth-child(7),
  #schedule-table th:nth-child(8),
  #schedule-table td:nth-child(8) {
    display: none;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Calendar Styles */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.calendar-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.calendar-nav-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
}

.calendar-nav-btn:hover {
  background: var(--primary-dark);
}

.calendar-month-select,
.calendar-year-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
}

.calendar-year-input {
  width: 80px;
}

.calendar-today-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.calendar-today-btn:hover {
  background: #475569;
}

.calendar-tour-leg-filter {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
}

.calendar-container {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
  overflow-x: visible;
  overflow-y: visible;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.calendar-4month-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calendar-month-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.calendar-grid-container {
  position: relative;
}


.calendar-month-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  padding: 0.75rem;
  background: var(--background);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.375rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.calendar-day-header {
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.75rem 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.5rem;
}

.calendar-day-header.weekend {
  color: var(--primary-color);
  font-weight: 800;
}

.calendar-day {
  min-height: 90px;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 0.375rem;
  background: var(--surface);
  position: relative;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.calendar-day:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.calendar-day.other-month {
  background: var(--background);
  opacity: 0.4;
  border-color: var(--background);
}

.calendar-day.other-month:hover {
  opacity: 0.6;
}

.calendar-day.today {
  border-color: var(--primary-color);
  border-width: 3px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.calendar-day.today:hover {
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.calendar-day-number {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.calendar-day.today .calendar-day-number {
  color: var(--primary-color);
  font-weight: 800;
  font-size: 1.125rem;
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-height: 0;
}

.calendar-event {
  font-size: 0.75rem;
  padding: 0.5rem 0.625rem;
  border-radius: 6px;
  background: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.calendar-event:hover {
  background: var(--primary-dark);
  transform: translateX(3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.calendar-event[data-tour-leg-color]:hover {
  filter: brightness(0.85);
  transform: translateX(3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Date and Community Tags */
.date-tag,
.community-tag {
  transition: transform 0.2s, box-shadow 0.2s;
}

.date-tag:hover,
.community-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.tour-leg-event td {
  vertical-align: middle;
}

.calendar-event.stratcom {
  background: #ef4444;
}

.calendar-event.stratcom:hover {
  background: #dc2626;
}

.calendar-event.famcom {
  background: #3b82f6;
}

.calendar-event.famcom:hover {
  background: #2563eb;
}

.calendar-event.other {
  background: #64748b;
}

.calendar-event.other:hover {
  background: #475569;
}

.calendar-event-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-type-badge {
  font-size: 0.625rem;
  padding: 0.1875rem 0.5rem;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-event-more {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.375rem;
  padding: 0.25rem 0.5rem;
  text-align: center;
  background: var(--background);
  border-radius: 4px;
  font-weight: 500;
}

/* Calendar event tooltip */
.calendar-event-tooltip {
  position: absolute;
  background: var(--text-primary);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  max-width: 250px;
  display: none;
}

.calendar-event-tooltip.show {
  display: block;
}

