:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(23, 32, 54, 0.85);
  --bg-card-hover: rgba(30, 42, 69, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-hover: rgba(56, 189, 248, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
}

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

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

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  height: 60px;
  flex-shrink: 0;
}

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

.logo-icon, .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-text h1, .header-brand h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.accent-text {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline, .brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

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

/* Main Layout */
.main-layout, .app-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
}

/* Sidebar */
.sidebar {
  width: 380px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  z-index: 10;
  flex-shrink: 0;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card h2, .card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 i, .card h3 i {
  color: var(--accent-cyan);
}

/* Drop Zone */
.dropzone, .drop-zone {
  position: relative;
  border: 2px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.25s ease;
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover, .drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}

.dropzone-icon, .drop-icon {
  font-size: 2rem;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

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

.stat-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Form Controls */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 40px;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

.form-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  gap: 10px;
  min-height: 32px;
}

.checkbox-container input {
  cursor: pointer;
  accent-color: var(--accent-cyan);
  width: 18px;
  height: 18px;
}

/* Files List */
.files-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 4px;
}

.empty-state {
  text-align: center;
  padding: 20px 12px;
  color: var(--text-dark);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.empty-state small {
  font-size: 0.75rem;
}

/* Track File Item */
.track-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-item:hover {
  border-color: var(--border-color-hover);
  background: rgba(30, 42, 69, 0.6);
}

.track-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.track-color-picker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.track-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.track-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.track-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.track-metrics {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 30px;
}

.metric-tag {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Track Trimming Sliders Section */
.track-trim-controls {
  margin-top: 4px;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.trim-count-badge {
  font-size: 0.68rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.trim-slider-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trim-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.trim-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  margin: 4px 0;
}

.trim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

.trim-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  border: none;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #3b82f6);
  color: white;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1, #2563eb);
}

.btn-secondary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
}

.btn-outline-info {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn-outline-info:hover {
  background: rgba(56, 189, 248, 0.2);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn-danger:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.15);
}

/* Map Panel Container & Controls */
.map-container-wrapper, .map-panel {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.map-view {
  width: 100%;
  height: 100%;
  flex: 1;
  z-index: 1;
  background: #0f172a;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-tool-group {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.map-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.map-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
}

.layer-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--accent-cyan);
  min-height: 36px;
}

.layer-select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  padding-right: 4px;
}

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

/* Elevation Panel */
.elevation-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 190px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  z-index: 500;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

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

.elevation-panel-header h3 {
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-cyan);
}

.elevation-track-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.elevation-chart-container {
  flex: 1;
  position: relative;
  width: 100%;
}

/* Modal Overlay & Video Animator Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(10px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-preview-wrapper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
}

/* Mobile Navigation Bar */
.mobile-nav-tabs {
  display: none;
}

/* Mobile Responsive Breakpoints */
@media (max-width: 768px) {
  .app-header {
    padding: 8px 12px;
  }

  .brand-text h1, .header-brand h1 {
    font-size: 1.1rem;
  }

  .tagline, .brand-subtitle {
    display: none;
  }

  .btn-text {
    display: none;
  }

  .main-layout, .app-content {
    flex-direction: column;
    height: calc(100vh - 60px - 56px);
    height: calc(100dvh - 60px - 56px);
  }

  .sidebar {
    width: 100%;
    height: 100%;
    border-right: none;
    display: none;
    padding: 12px;
  }

  .sidebar.active {
    display: flex;
  }

  .map-container-wrapper, .map-panel {
    width: 100%;
    height: 100%;
    display: flex;
  }

  .map-container-wrapper.hidden, .map-panel.hidden {
    display: none;
  }

  .map-toolbar {
    top: 8px;
    right: 8px;
    left: 8px;
    justify-content: space-between;
  }

  .map-btn-text {
    display: none;
  }

  .elevation-panel {
    height: 160px;
    padding: 8px 10px;
  }

  .mobile-nav-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 2000;
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    gap: 4px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
  }

  .mobile-tab-btn i {
    font-size: 1.1rem;
  }

  .mobile-tab-btn.active {
    color: var(--accent-cyan);
  }

  .mobile-tab-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 2px;
  }
}

/* Project Workspace Card & Modal Styles */
.project-card {
  border-left: 4px solid var(--accent-emerald);
}

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

.auto-save-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s ease;
}

.auto-save-tag.saved {
  color: var(--accent-emerald);
}

.project-btn-group {
  display: flex;
  gap: 8px;
}

.project-btn-group .btn {
  flex: 1;
}

.modal-card-wide {
  max-width: 760px;
  width: 90%;
}

.projects-actions-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.project-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.project-item-card:hover {
  border-color: var(--border-color-hover);
  background: rgba(30, 42, 69, 0.6);
}

.project-item-card.active-project {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.project-item-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-active {
  background: var(--accent-emerald);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.project-item-meta {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.btn-outline-warning {
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
  background: transparent;
}
.btn-outline-warning:hover:not(:disabled) {
  background: var(--accent-amber);
  color: #0f172a;
}

