/* Import Poppins font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.6;
}

/* Page container with navigation */
.page-container {
  min-height: 100vh;
  display: flex;
}

/* Navigation */
.main-navigation {
  width: 280px;
  min-height: 100vh;
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
}

.nav-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.nav-logo {
  display: block;
  text-decoration: none;
}

.nav-logo-img {
  height: 50px;
  width: auto;
}

.nav-links {
  padding: 1rem 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: #6b7280;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: #f9fafb;
  color: #3b82f6;
}

.nav-link.active {
  background: #eff6ff;
  color: #3b82f6;
  border-left-color: #3b82f6;
}

.nav-icon {
  font-size: 1.2rem;
  margin-right: 0.75rem;
  min-width: 20px;
}

.nav-text {
  font-weight: 500;
}

/* Page content area */
.page-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}




/* Main content areas */
.calculator-main {
  flex: 1;
  padding: 2rem 1rem;
  background: #f5f5f5;
}

.main-content {
  flex: 1;
  padding: 2rem 1rem;
  background: #f5f5f5;
}

.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: #6b7280;
}

.td-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.td-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Calculator grid for home page */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.calculator-card {
  display: block;
  background: white;
  border-radius: 16px;
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
  text-align: center;
  margin: 0 auto;
}

.calculator-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
}

.calculator-card.coming-soon {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.card-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
}

.calculator-card h3 {
  font-size: 1.5rem;
  color: #3b82f6;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.calculator-card p {
  color: #6b7280;
  line-height: 1.6;
}

.calculator-wrapper {
  max-width: 900px;
  margin: 0 auto;
}

.calculator-title {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}

.calculator-subtitle {
  font-size: 1.1rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 2rem;
}

/* Calculator card */
.calculator-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Unit toggle */
.unit-toggle-container {
  display: flex;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 2rem;
}

.unit-btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.unit-btn.active {
  background: white;
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.2;
  min-height: 1.08rem;
  display: flex;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

/* Input with unit */
.input-with-unit {
  display: flex;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  height: 48px;
  box-sizing: border-box;
  align-items: center;
}

.input-with-unit input {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: #1a1a1a;
  height: 48px;
  box-sizing: border-box;
  outline: none;
}

.input-with-unit .unit {
  padding: 0.75rem;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.9rem;
  border-left: 1px solid #e5e7eb;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 500;
  min-width: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Select */
.form-select {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  background: #f9fafb;
  color: #1a1a1a;
  cursor: pointer;
  height: 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* Slider */
.slider-container {
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
}

.slope-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  margin: 0;
}

.slope-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

.slope-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.slope-value {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: #6b7280;
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Power and Speed sections */
.power-section,
.speed-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.power-label,
.speed-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 1rem;
}

.power-input-wrapper,
.speed-input-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.power-input,
.speed-input {
  width: 200px;
  padding: 0.75rem;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: #1a1a1a;
  background: white;
  height: 48px;
  box-sizing: border-box;
}

.power-unit,
.speed-unit {
  font-size: 1rem;
  color: #6b7280;
}

/* Result section */
.result-section {
  background: #3b82f6;
  color: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.result-label {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.result-value {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.result-unit {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Focus states */
input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
}

.power-input:focus,
.speed-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modern mobile navigation */
.mobile-nav-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
  z-index: 1001;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.mobile-nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-toggle:hover {
  background-color: #f3f4f6;
}

.menu-icon {
  width: 24px;
  height: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
}

.menu-icon span {
  background-color: #374151;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Menu icon animation to X */
.mobile-nav-toggle.active .menu-icon span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-nav-toggle.active .menu-icon span:nth-child(2) {
  transform: rotate(-45deg) translate(-6px, 6px);
}

.mobile-nav-toggle.active .menu-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-nav-toggle.active .menu-icon span:nth-child(4) {
  transform: rotate(45deg) translate(-6px, -6px);
}

/* Slide-out navigation drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: white;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 1002;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  left: 0;
}

.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.mobile-drawer-logo {
  height: 40px;
  width: auto;
}

.mobile-drawer-links {
  padding: 1rem 0;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: #374151;
  transition: background-color 0.2s;
  border-left: 3px solid transparent;
}

.mobile-drawer-link:hover {
  background-color: #f9fafb;
}

.mobile-drawer-link.active {
  background-color: #eff6ff;
  color: #3b82f6;
  border-left-color: #3b82f6;
}

.mobile-drawer-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
  min-width: 24px;
}

.mobile-drawer-text {
  font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
  /* Hide desktop navigation */
  .main-navigation {
    display: none;
  }
  
  /* Show mobile header */
  .mobile-nav-header {
    display: block;
  }
  
  /* Adjust page layout for mobile header */
  .page-container {
    flex-direction: column;
    padding-top: 80px; /* Space for mobile header */
  }
  
  .page-content {
    margin-left: 0;
  }
  
  /* Center home page content on mobile */
  .home-container {
    text-align: center;
  }
  
  .welcome-section {
    text-align: center;
    padding: 0 1rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .calculator-card {
    padding: 1.5rem;
    max-width: 380px;
    margin: 0 auto 1.5rem auto;
  }
  
  .calculator-title {
    font-size: 1.75rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .result-value {
    font-size: 2.5rem;
  }
  
  .power-input,
  .speed-input {
    width: 150px;
    font-size: 1.25rem;
  }
  
  .calculator-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* Extra centering for very narrow mobile screens */
@media (max-width: 480px) {
  .content-wrapper {
    text-align: center;
    padding: 0 0.5rem;
  }
  
  .calculator-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  
  .calculator-card {
    max-width: 350px;
    width: 100%;
    margin: 0 auto 1.5rem auto;
  }
  
  .main-content {
    text-align: center;
  }
}

/* Remove all old styles below this line */

/* Header styles for layout.ejs (keeping for other pages) */
.header {
  background: white;
  border-bottom: 1px solid #d1d5db;
  padding: 1rem 2rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 40px;
  width: auto;
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  color: #2563eb;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 80px;
  width: 60px;
  height: calc(100vh - 80px);
  background: white;
  border-right: 1px solid #d1d5db;
  transition: width 0.3s ease;
  overflow: hidden;
  z-index: 900;
}

.sidebar.expanded {
  width: 250px;
}

.sidebar-toggle {
  padding: 1rem;
  cursor: pointer;
  border-bottom: 1px solid #d1d5db;
}

.hamburger {
  display: block;
  width: 20px;
  height: 2px;
  background: #374151;
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: #374151;
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  bottom: -6px;
}

.nav-links {
  list-style: none;
  padding: 0;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 1rem;
  color: #374151;
  text-decoration: none;
  transition: background-color 0.2s;
  gap: 1rem;
}

.nav-links a:hover {
  background-color: #f3f4f6;
}

.nav-links .icon {
  font-size: 1.2rem;
  min-width: 20px;
}

.nav-links .label {
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar.expanded .nav-links .label {
  opacity: 1;
}

/* Main Content */
.main-content {
  margin-left: 60px;
  margin-top: 80px;
  padding: 2rem;
  transition: margin-left 0.3s ease;
}

.sidebar.expanded + .main-content {
  margin-left: 250px;
}

/* Home page styles */
.home-container {
    max-width: 800px;
    margin: 0 auto;
}

.welcome-section {
    text-align: center;
    margin-bottom: 3rem;
}

.welcome-section h2 {
    font-size: 2.5rem;
    color: #2563eb;
    margin-bottom: 1rem;
}

.welcome-section p {
    font-size: 1.2rem;
    color: #6b7280;
}

.calculator-links {
    display: grid;
    gap: 1.5rem;
}

.calculator-card {
    display: block;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -1px rgba(0, 0, 0, 0.15);
    border-color: #2563eb;
}

.card-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.calculator-card h3 {
    font-size: 1.5rem;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.calculator-card p {
    color: #6b7280;
    line-height: 1.6;
}

/* Route Calculator Specific Styles */
.file-upload-section {
  margin-bottom: 2rem;
}

.file-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafafa;
}

.file-dropzone:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.file-dropzone.dragover {
  border-color: #10b981;
  background: #f0fdf4;
  transform: scale(1.02);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.upload-icon {
  font-size: 3rem;
  color: #6b7280;
}

.upload-text {
  font-size: 1.1rem;
  color: #374151;
  font-weight: 500;
}

.file-info {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.upload-progress {
  width: 100%;
  max-width: 300px;
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.5rem;
  display: block;
}

.calculator-form {
  border-top: 1px solid #e5e7eb;
  padding-top: 2rem;
}

.results-section {
  border-top: 2px solid #e5e7eb;
  padding-top: 2rem;
  margin-top: 2rem;
}

.primary-result {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
}

.primary-result .result-label {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.primary-result .result-value {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
}

.primary-result .result-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 0.5rem;
}

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

.result-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid transparent;
}

.terrain-card .card-header {
  border-bottom-color: #10b981;
}

.performance-card .card-header {
  border-bottom-color: #f59e0b;
}

.route-card .card-header {
  border-bottom-color: #3b82f6;
}

.card-icon {
  font-size: 1.5rem;
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.stat-row:not(:last-child) {
  border-bottom: 1px solid #f3f4f6;
}

.stat-row span:first-child {
  color: #6b7280;
  font-weight: 500;
}

.stat-row span:last-child {
  color: #111827;
  font-weight: 600;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
}

/* Route Calculator Responsive */
@media (max-width: 768px) {
  .file-dropzone {
    padding: 2rem 1rem;
  }
  
  .primary-result .result-value {
    font-size: 2.5rem;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .upload-icon {
    font-size: 2.5rem;
  }
  
  .upload-text {
    font-size: 1rem;
  }
}