:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --background-color: #1a1a1a;
  --card-color: #2c2c2c;
  --border-radius: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background-color);
  display: flex;
  flex-direction: column;
  color: #fff;
  transition: cursor 0.1s ease-in-out;
  min-height: 100vh;
  overflow-x: hidden;
}

body.calculating {
  cursor: progress !important;
}

/* Layout structure */
.main-content {
  position: relative;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #444 #222;
  padding-top: 70px; /* Add padding to account for fixed header */
  box-sizing: border-box;
}

.container {
  display: flex;
  flex-wrap: nowrap;
  gap: 1px;
  padding: 6px;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1610px;
  margin: 0 auto;
  box-sizing: border-box;
  flex: 1;
  justify-content: center;
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  backdrop-filter: blur(2px);
}

body.calculating .loading-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Simple spinner */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s ease infinite;
}

/* Section styling - each column */
.section {
  flex: 0 0 400px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: rgba(30, 30, 30, 0.9);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  overflow: visible !important;
  width: 300px;
  max-width: 300px;
}

/* Column specific styling */
#column-1 {
  background-color: rgba(26, 26, 26, 0.95);
}

#column-2 {
  background-color: rgba(30, 30, 30, 0.95);
}

#column-3 {
  background-color: rgba(32, 32, 32, 0.95);
  flex: 0 0 800px;
  width: 800px;
  max-width: 800px;
}

/* Car search card in column-1 */
#column-1 .card:first-child {
  flex-grow: 0;
  flex-shrink: 0;
}

/* Styling for car data cards in column-1 */
#column-1 .card:not(:first-child) {
  margin-bottom: 3px;
  padding: 6px 10px 5px;
}

#column-1 .card:not(:first-child) .card-title {
  font-size: 12px;
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(80, 80, 80, 0.5);
  line-height: 1.2;
}

#column-1 .card:not(:first-child) .form-group {
  margin-bottom: 3px;
  padding: 1px 0;
  min-height: auto;
}

#column-1 .card:not(:first-child) input, 
#column-1 .card:not(:first-child) select {
  width: 90px;
  padding: 2px 5px;
  height: 22px;
  font-size: 13px;
  border-radius: 3px;
}

/* Column-specific tooltip style */
#column-1 label[data-tooltip]::after {
  padding: 3px 6px;
  font-size: 10px;
  bottom: 110%;
}

#column-1 .card:not(:first-child) .form-group:hover {
  position: relative;
  z-index: 50;
}

/* Column-1 specific toggle styling */
#column-1 .toggle-container {
  margin: 3px 0;
  align-items: center;
}

#column-1 .toggle-label {
  font-size: 11px;
  letter-spacing: 0.3px;
}

#column-1 .toggle-switch {
  margin-right: 6px;
  min-width: 28px;
  height: 16px;
}

#column-1 .toggle-slider:before {
  height: 12px;
  width: 12px;
  bottom: 2px;
  left: 2px;
}

#column-1 .toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(12px);
}

/* Apply consistent styling to ensure all car data elements in column-1 */
#column-1 .card {
  margin-bottom: 2px;
}

/* Card styling */
.card, .card1 {
  background-color: rgba(30, 30, 30, 0.9);
  padding: 16px;
  height: fit-content;
  transition: opacity 0.2s ease-in-out;
  border-radius: 8px;
  box-shadow: none;
  border-bottom: 1px solid rgba(60, 60, 60, 0.3);
  overflow: visible !important;
}

.section > .card:last-child,
.section > .card1:last-child {
  border-bottom: none;
}

.card1 {
  height: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.card.disabled {
  opacity: 0.5;
  pointer-events: none;
  background-color: rgba(40, 40, 40, 0.9);
}

.card.disabled .card-title,
.card.disabled .toggle-container {
  opacity: 1;
  pointer-events: auto;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 15px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #444;
  padding-bottom: 8px;
  background-color: transparent;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  background: linear-gradient(to right, rgba(30, 30, 30, 0.3), transparent);
  display: flex;
  align-items: center;
}

/* Collapsible card titles */
.card-title.collapsible {
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  padding: 10px 12px;
  margin-bottom: 0;
  border-radius: 4px;
  gap: 10px;
  display: flex;
  align-items: center;
}

.card-title.collapsible:hover {
  background: linear-gradient(to right, rgba(52, 152, 219, 0.3), transparent);
}

.card-title.collapsible .section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.card-title.collapsible .section-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--primary-color);
}

.card-title.collapsible .title-text {
  flex: 1;
  display: flex;
  align-items: center;
}

.card-title.collapsible .collapse-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  stroke: var(--primary-color);
}

/* Collapsed state - hide content */
.card-title.collapsible.collapsed ~ .card-content {
  display: none;
  max-height: 0;
  overflow: hidden;
}

/* Start with sections collapsed by default */
.card-title.collapsible ~ .card-content {
  display: none;
}

/* Rotate arrow when expanded (opposite of collapsed) */
.card-title.collapsible .collapse-icon {
  transform: rotate(-90deg);
}

.card-title.collapsible.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.card-title.collapsible:not(.collapsed) .collapse-icon {
  transform: rotate(0deg);
}

/* Card content styling */
.card-content {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

/* Tooltip styling */
label[data-tooltip] {
  position: relative;
  cursor: help;
  z-index: 50;
}

label[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: rgb(37, 37, 37);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  visibility: hidden;
}

label[data-tooltip]:hover::after {
  opacity: 1;
  transition-delay: 0.1s;
  visibility: visible;
}

/* Tooltip responsive adjustment */
@media (max-width: 768px) {
  label[data-tooltip]::after {
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
  }
}

/* Form elements styling */
.form-group {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group:hover {
  z-index: 40;
}

.toggle-container {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding: 5px 0;
}

label {
  margin-right: 10px;
  font-size: 13px;
  flex-shrink: 0;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  max-width: 60%;
}

input, select {
  width: 120px;
  padding: 8px;
  border: 1px solid rgba(100, 100, 100, 0.8);
  box-sizing: border-box;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.3s, background-color 0.3s;
  background-color: rgba(50, 50, 50, 0.9);
  color: #fff;
}

input:focus, select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

input:disabled, select:disabled {
  background-color: #555;
  cursor: not-allowed;
}

/* Chart containers */
.chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 500px;
  margin-bottom: 0;
  overflow: visible !important;
}

.performance-chart-container,
.power-curve-chart-container {
  height: 100%;
  width: 100%;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  overflow: visible !important;
}

.power-curve-chart-container {
  padding-top: 10px;
}

.section:nth-child(3) .card1 {
  flex: 1;
  min-height: 400px;
  width: 100%;
}

.chart canvas {
  max-width: 100%;
  height: auto !important;
}

#accelChartCanvas,
#powerCurveChartCanvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 500px;
}

/* Results styling */
.result-section-title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  margin: 16px 0 8px 0;
  color: var(--primary-color);
  border-top: 1px solid rgba(80, 80, 80, 0.3);
  padding-top: 10px;
}

.result-section-title:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* Car image container - full width */
.car-image-container {
  width: 100%;
  margin: 8px 0;
  text-align: center;
}

.car-image-container img {
  display: none;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#noImageMessage {
  display: none;
  color: #999;
  font-size: 12px;
  margin-top: 8px;
}

/* Spec bubbles for selected car details - matching search result tag colors */
.spec-bubble {
  display: inline-block;
  padding: 3px 6px; /* Reduced by 2x */
  margin: 2px 2px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  border: 1.5px solid rgba(120, 120, 120, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.spec-value {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* Specific bubble colors - matching search result tag colors */
.model-bubble {
  background-color: rgba(80, 80, 80, 0.15);
  border-color: rgba(120, 120, 120, 0.4);
}

.fuel-bubble {
  background-color: rgba(255, 152, 0, 0.15);
  border-color: rgba(255, 152, 0, 0.5);
}

.drivetrain-bubble {
  background-color: rgba(33, 150, 243, 0.15);
  border-color: rgba(33, 150, 243, 0.5);
}

.transmission-bubble {
  background-color: rgba(0, 188, 212, 0.15);
  border-color: rgba(0, 188, 212, 0.5);
}

.power-bubble {
  background-color: rgba(76, 175, 80, 0.15);
  border-color: rgba(76, 175, 80, 0.5);
}

/* Selected car details container */
.selected-car-details {
  text-align: center;
  padding: 4px 0;
}

#iBHP.result-value {
  width: 80px;
  text-align: right;
  padding: 4px 6px;
  margin-left: 5px;
  border: 1px solid #ccc;
  font-weight: normal;
}

.result-section {
  margin-bottom: 15px;
}

/* Results display styling */
.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(80, 80, 80, 0.2);
}

.result-item:last-child {
  border-bottom: none;
}

.result-name {
  flex: 0 0 auto;
  font-weight: 500;
  color: #ccc;
  text-align: left;
}

.result-value {
  flex: 0 0 auto;
  font-weight: 600;
  color: #fff;
  text-align: right;
  font-family: 'Courier New', monospace;
}

/* Highlighted result rows (bold) */
.highlight-row {
  font-weight: 700 !important;
}

.highlight-row .result-name {
  font-weight: 700 !important;
}

.highlight-row .result-value {
  font-weight: 700 !important;
}

/* Toggle switch styling */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  margin-right: 12px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 13px;
}

/* Custom range inputs */
.custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.custom-range input {
  width: 60px;
}

.custom-range strong {
  font-weight: 600;
}

/* Responsive layout */
@media (max-width: 1230px) {
  .container {
    flex-direction: column;
    align-items: center;
  }
  
  .section {
    margin-bottom: 1px;
    width: 100%;
    max-width: 400px;
  }
  
  #column-3 {
    max-width: 800px;
    width: 100%;
  }
}

@media (max-width: 992px) {
  .container {
    flex-direction: column;
    padding: 10px;
  }
  
  .section {
    margin-bottom: 1px;
    width: 100%;
  }
  
  /* Order of columns */
  #column-1 {
    order: 1;
  }
  
  #column-2 {
    order: 2;
  }
  
  #column-3 {
    order: 3;
    max-width: 800px;
  }
}

/* Header styling */
header {
  position: fixed;
  top: 0;
  width: 100%;
  height: 60px;
  background-color: rgba(10, 10, 10, 0.95);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.logo-container {
  height: 40px;
  display: flex;
  align-items: center;
}

.logo-container img {
  height: 100%;
  width: auto;
}

.logo-sound-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-left: 12px;
  padding: 0;
}

.logo-sound-toggle:hover {
  opacity: 0.7;
}

.header-middle {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
}

.header-toggle {
  margin: 0 20px;
}

.header-toggle .toggle-label {
  font-size: 0.85em;
  letter-spacing: 0.5px;
  color: #eee;
}

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

/* Header icon buttons (export/import) */
.header-icon-btn {
  background: #555;
  border: 1px solid #666;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s;
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.header-icon-btn:hover {
  background-color: #666;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.header-icon-btn svg {
  stroke: #fff;
}

#sound-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: opacity 0.2s;
}

#sound-toggle:hover {
  opacity: 0.8;
}

/* Car selector button styling */
#selectCarBtn, #clearCarBtn, #resetPowerCurveBtn {
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 12px;
  border: none;
  transition: background-color 0.2s;
}

#selectCarBtn {
  background-color: #333;
  color: #fff;
}

#clearCarBtn, #resetPowerCurveBtn {
  background-color: #777;
  color: #fff;
  margin-left: auto;
}

#selectCarBtn:hover {
  background-color: #555;
}

#clearCarBtn:hover, #resetPowerCurveBtn:hover {
  background-color: #999;
}

/* Car search styling */
.car-search-group {
  /* No label, so no need to align items */
}

#carSearchInput {
  width: 100%;
  padding: 10px 12px; /* 30% taller than 8px */
  border-radius: 9px; /* 50% larger than 6px */
  font-size: 16px; /* Slightly larger font for better UX */
}

.car-search-results {
  height: 300px;
  overflow-y: auto;
  margin-top: 15px;
  border: 1px solid #444;
  border-radius: 4px;
  background-color: rgba(40, 40, 40, 0.8);
  display: flex;
  flex-direction: column;
}

.car-search-results::-webkit-scrollbar {
  width: 8px;
}

.car-search-results::-webkit-scrollbar-track {
  background: #333;
  border-radius: 4px;
}

.car-search-results::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 4px;
}

.car-search-results::-webkit-scrollbar-thumb:hover {
  background: #888;
}

.car-result-card {
  padding: 10px 12px;
  border-bottom: 1px solid #555;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.car-result-card:last-child {
  border-bottom: none;
}

.car-result-card:hover {
  background-color: rgba(60, 60, 60, 0.9);
}

.car-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.car-card-details {
  font-size: 12px;
  color: #bbb;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 4px;
}

.car-card-details span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  padding: 3px 4px;
  border-radius: 3px;
  background-color: rgba(30, 30, 30, 0.7);
}

.loading-indicator, .no-results, .error-message {
  padding: 15px;
  text-align: center;
  font-style: italic;
  color: #888;
}

.selected-car-details {
  margin-top: 15px;
  padding-top: 10px;
  border-top: none;
}

/* Disabled state for form group when car is selected */
.disabled-with-car {
  opacity: 0.7;
  position: relative;
  pointer-events: none;
}

.disabled-with-car label {
  cursor: not-allowed;
}

.disabled-with-car::after {
  content: "Fixed by selection";
  position: absolute;
  font-size: 9px;
  color: #ffcc80;
  bottom: -10px;
  left: 5px;
  background-color: rgba(0,0,0,0.5);
  padding: 1px 3px;
  border-radius: 2px;
  z-index: 1;
}

/* Power curve controls */
.power-curve-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  padding: 0 10px;
}

.power-curve-controls button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.power-curve-controls button:hover {
  background: #c0392b;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.power-curve-controls button:disabled {
  background: #555;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

/* Video background */
#video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -10;
  pointer-events: none;
  overflow: hidden;
}

#video-background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  transform: translate(-50%, -50%);
  object-fit: cover;
  border: none;
}

#video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(20, 20, 20, 1);
  z-index: -5;
  pointer-events: none;
}

/* Footer styles */
.footer {
  margin-top: auto;
  padding: 12px 20px;
  background-color: rgba(20, 20, 20, 0.95);
  color: #aaa;
  font-size: 12px;
  border-top: 1px solid #444;
  width: 100%;
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #aaa;
  text-decoration: none;
  transition: color 0.2s;
  font-size: 11px;
}

.footer-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.footer-feedback {
  flex-grow: 1;
  max-width: 500px;
  margin: 0 15px;
  position: relative;
}

.footer-feedback-form {
  display: flex;
  height: 28px;
}

.footer-feedback-form input {
  flex-grow: 1;
  padding: 5px 10px;
  background-color: rgba(50, 50, 50, 0.9);
  border: 1px solid #444;
  border-right: none;
  border-radius: 4px 0 0 4px;
  color: #fff;
  font-size: 11px;
  height: 100%;
}

.footer-feedback-form button {
  padding: 5px 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 11px;
  height: 100%;
}

.footer-feedback-form button:hover {
  background-color: #2980b9;
}

.footer-feedback-status {
  display: none;
  font-size: 10px;
  margin-top: 3px;
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -16px;
}

.footer-feedback-status.success {
  color: #2ecc71;
  display: block;
}

.footer-feedback-status.error {
  color: #e74c3c;
  display: block;
}

.copyright {
  text-align: right;
  white-space: nowrap;
  font-size: 11px;
}

/* Modal styles */
.modal, .modal-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 2000;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
}

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

.modal-content {
  background-color: rgba(40, 40, 40, 0.95);
  width: 70%;
  max-width: 800px;
  max-height: 80vh;
  border-radius: 8px;
  border: 1px solid #444;
  padding: 20px;
  position: relative;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 20px;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #fff;
}

.modal h2 {
  color: var(--primary-color);
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #444;
}

.modal p {
  margin-bottom: 15px;
  line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .footer-content {
    flex-direction: column;
    gap: 12px;
  }
  
  .footer-feedback {
    width: 100%;
    max-width: 100%;
    margin: 12px 0;
    order: 3;
  }
  
  .footer-links {
    justify-content: center;
    order: 1;
    width: 100%;
  }
  
  .copyright {
    text-align: center;
    order: 2;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .footer {
    padding: 10px;
  }
  
  .footer-content {
    padding: 0 10px;
  }
  
  .footer-feedback-form {
    flex-direction: column;
    gap: 10px;
    height: auto;
  }
  
  .footer-feedback-form input {
    width: 100%;
    border-radius: 4px;
    border-right: 1px solid #444;
    margin-bottom: 5px;
  }
  
  .footer-feedback-form button {
    width: 100%;
    border-radius: 4px;
  }
  
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 20px;
  }
  
  .footer-feedback-status {
    position: static;
    margin-top: 5px;
  }
}

/* Fix for Calculate HP from Acceleration toggle */
#measuredDataCard {
  background-color: rgba(20, 60, 30, 0.2);
  border-radius: 6px;
}

#measuredDataCard .card-title {
  margin-bottom: 12px;
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#measuredDataCard .toggle-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: var(--primary-color);
}

/* Ensure the toggle switch is properly aligned */
#measuredDataCard .toggle-switch {
  margin-right: 0;
  margin-left: auto;
  width: 42px;
  height: 22px;
}

#measuredDataCard .toggle-slider:before {
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
}

#measuredDataCard .toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Make the form elements more compact but still readable */
#measuredDataCard .form-group {
  margin-bottom: 8px;
}

#measuredDataCard .toggle-slider {
  width: 42px;
}

/* Card title icon styles have been removed */

/* Heatsoak controls styling */
.heatsoak-container,
.heatsoak-controls,
.heatsoak-controls input[type="text"],
.heatsoak-controls .unit-label {
  /* These styles are removed/reset */
}

.toggle-switch-small {
  min-width: 28px;
  height: 16px;
}

.toggle-switch-small .toggle-slider:before {
  height: 12px;
  width: 12px;
  bottom: 2px;
  left: 2px;
}

.toggle-switch-small input:checked + .toggle-slider:before {
  transform: translateX(12px);
}

.heatsoak-label-toggle {
  display: flex;
  align-items: center;
  flex: 0 0 48%;
}

.heatsoak-label-toggle label {
  margin-right: 8px;
}

/* Disabled state for heatsoak percentage input */
input[type="text"].heatsoak-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: rgba(40, 40, 40, 0.9);
  border-color: rgba(70, 70, 70, 0.5);
  pointer-events: none;
  transition: opacity 0.3s, background-color 0.3s, border-color 0.3s;
}

.heatsoak-label-toggle.disabled {
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.3s;
}

.heatsoak-label-toggle.disabled label {
  cursor: not-allowed;
  color: #aaa;
  transition: color 0.3s;
}

/* Enabled state for heatsoak percentage input */
input[type="text"]#iHeatSoakPct {
  transition: opacity 0.3s, background-color 0.3s, border-color 0.3s;
}

/* For when heatsoak is enabled */
.heatsoak-label-toggle:not(.disabled) input[type="text"]#iHeatSoakPct {
  border-color: rgba(100, 100, 100, 0.8);
  background-color: rgba(50, 50, 50, 0.9);
}

/* Export/Import Buttons */
.action-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 8px 16px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.action-button:hover {
  background-color: #45a049;
}

#exportDataBtn {
  background-color: #2196F3;
}

#exportDataBtn:hover {
  background-color: #0b7dda;
}

#importDataBtn {
  background-color: #ff9800;
}

#importDataBtn:hover {
  background-color: #444;
}

/* --- Community Page Styles (Modal Overlay) --- */
#communityPageContainer {
  position: fixed; /* Changed from relative */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95); /* Dark background with opacity */
  z-index: 1000; /* Ensure it's above other content */
  display: none; /* Initially hidden - controlled by JS */
  overflow-y: auto; /* Allow scrolling within the modal */
  padding: 20px; /* Add some padding */
  box-sizing: border-box;
}

/* Add a container inside the modal for content styling */
.community-modal-content-wrapper {
    max-width: 1200px; /* Adjust as needed */
    margin: 30px auto; /* Center the content */
    background-color: #222; /* Darker background for the content area */
    padding: 20px;
    border-radius: 8px;
    position: relative; /* For positioning the close button */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.community-page {
  /* Remove specific layout properties if they conflict with modal */
  /* display: block; /* Remove this if display is handled by the main rule */
  /* padding-top: 70px; /* Remove or adjust as needed */
}

.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #444; /* Adjust color */
}

.close-button {
  /* Style the close button (top right or similar) */
  background: #555;
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
  float: right; /* Example positioning */
}

.back-button {
   /* Style the back button in detail view */
  background: #555;
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 15px;
}

.community-nav {
  margin-bottom: 20px;
  border-bottom: 1px solid #444;
}

.community-nav .tab-button {
  padding: 10px 15px;
  cursor: pointer;
  background: none;
  border: none;
  color: #ccc; /* Adjust color */
  border-bottom: 3px solid transparent;
  margin-right: 5px;
}

.community-nav .tab-button.active {
  color: #fff; /* Adjust color */
  border-bottom-color: var(--accent-color, #4CAF50); /* Use accent color */
}

.community-content-area .tab-pane {
  display: none; /* Hide inactive tabs */
}

.community-content-area .tab-pane.active {
  display: block; /* Show active tab */
}

.tab-controls {
  margin-bottom: 15px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.05); /* Slight background */
  border-radius: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-controls input[type="text"],
.tab-controls select {
  padding: 8px;
  background-color: #333;
  border: 1px solid #555;
  color: #fff;
  border-radius: 4px;
}

.tab-controls button {
  padding: 8px 15px;
  background-color: var(--accent-color, #4CAF50);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.tab-results {
  height: calc(100vh - 220px);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Build Card Styling */
.build-card {
  position: relative;
  background-color: transparent;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 15px;
  margin-bottom: 20px;
  width: 600px;
  max-width: 100%;
  transition: all 0.3s ease;
  cursor: pointer;
}

.build-card:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.build-card .rank {
  position: absolute;
  top: 5px;
  left: 5px;
  background-color: var(--accent-color, #4CAF50);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: bold;
}

.build-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 10px;
}
.build-card-no-image {
  width: 100%;
  height: 150px; 
  background-color: #333;
  border-radius: 3px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
}
.build-card-no-image::after {
  content: "No Image";
}

.build-card-title {
  margin: 0 0 5px 0;
  font-size: 1.1em;
}

.build-card-author,
.build-card-car {
  font-size: 0.9em;
  color: #bbb;
  margin: 2px 0;
}

.build-card-stats span {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
}

.build-card-stats .metric-separator {
  margin-left: 2px;
  margin-right: 7px;
  color: #666;
}

.build-card-stats span:last-child {
  margin-right: 0;
}

/* Build Detail View Styles */
.build-detail-container {
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
}

.build-detail-image {
  max-width: 100%;
  max-height: 400px;
  display: block;
  margin: 15px auto;
  border-radius: 4px;
}

.build-actions {
  margin: 20px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.like-button {
  background: #555;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}

.like-button.liked {
  background-color: var(--accent-color, #4CAF50);
}

.code-block {
  background-color: #222;
  padding: 10px;
  border-radius: 4px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #444;
}

/* Expanded Build Card Styles */
.build-card.expanded {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  margin-bottom: 30px;
}

.build-card-expanded {
  padding: 15px;
  border-top: 1px solid #444;
  background-color: rgba(0, 0, 0, 0.2);
}

.build-expanded-content {
  width: 100%;
}

.expanded-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.collapse-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #333;
  color: white;
  border: none;
  border-radius: 3px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 5;
  transition: background-color 0.2s;
}

.collapse-btn:hover {
  background-color: #555;
}

.expanded-body {
  padding: 0 10px;
}

.expanded-body h3 {
  font-size: 16px;
  margin: 15px 0 10px;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
  color: #ddd;
}

.expanded-description {
  margin-bottom: 15px;
  font-size: 14px;
  line-height: 1.5;
  color: #ccc;
}

.expanded-performance-stats ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}

.expanded-performance-stats li {
  margin-right: 15px;
  margin-bottom: 5px;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  color: #ddd;
}

.expanded-actions {
  margin: 15px 0;
  display: flex;
  gap: 10px;
}

.expanded-comments-section {
  margin-top: 20px;
}

.add-comment-form textarea {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  resize: vertical;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid #444;
  color: #ddd;
}

.verified-badge {
  color: #4CAF50;
  font-size: 12px;
  font-weight: normal;
}

.unverified-badge {
  color: #FFA500;
  font-size: 12px;
  font-weight: normal;
}

/* Comments Section Styles */
#comments-list-container {
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.comment {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  border-left: 3px solid #555;
}

.comment strong {
  color: #eee;
}

.comment-date {
  font-size: 0.8em;
  color: #aaa;
  margin-left: 5px;
}

.comment-image {
  max-width: 100px;
  max-height: 100px;
  display: block;
  margin-top: 5px;
  border-radius: 3px;
}

#comment-form-detail textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  background-color: #333;
  border: 1px solid #555;
  color: #fff;
  border-radius: 4px;
  margin-bottom: 5px;
  box-sizing: border-box;
}

#comment-form-detail button {
  padding: 8px 15px;
  background-color: var(--accent-color, #4CAF50);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Spinner for loading */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid #fff;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message {
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
  border: 1px solid #ff6b6b;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
}

/* Adjust main content padding maybe */
.main-content {
  /* padding: 15px; Already exists? */
}

/* --- NEW Calculator Display Cards --- */
#calculator-display-cards {
    /* Initially hidden, shown by JS */
    /* display: none; */ 
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #555;
}

#calculator-display-cards .card {
    margin-bottom: 15px; 
    background-color: #333; /* Slightly different background? */
    padding: 10px 15px; /* Adjust padding */
}

#calculator-display-cards .card-title {
    margin-bottom: 8px;
    font-size: 1.1em; 
    color: #eee;
    border-bottom: none; /* Remove extra border if reusing card title */
}

#calculator-display-cards .card-content {
    font-size: 0.95em;
    line-height: 1.5;
    color: #ccc;
}

/* Specific card styles */
#car-description-content {
    white-space: pre-wrap; /* Respect line breaks in description */
    max-height: 150px;
    overflow-y: auto;
    background-color: #2a2a2a; /* Inner background */
    padding: 8px;
    border-radius: 3px;
}

#car-images-gallery .image-gallery-main img,
#dragy-proof-gallery .image-gallery-main img {
    max-height: 250px; /* Limit height in these smaller cards */
}

#car-images-gallery .image-gallery-thumbnails img,
#dragy-proof-gallery .image-gallery-thumbnails img {
     max-width: 50px; /* Smaller thumbnails */
     max-height: 50px;
}

/* Style for placeholder text */
#car-images-gallery p,
#dragy-proof-gallery p {
    color: #888;
    text-align: center;
    padding: 20px 0;
}

/* Indicator for Dragy images in the gallery */
.dragy-indicator {
    /* Style defined in createImageGallery, but can add overrides */
}
.dragy-indicator-thumb {
     /* Style defined in createImageGallery */
}

/* --- NEW: Calculator Display Cards --- */
#calculator-display-cards {
  /* Container is already in HTML, initially hidden via inline style */
  /* Add margin if needed, e.g., margin-top: 20px; */
  /* Visibility controlled by JS */
}

#calculator-display-cards .card {
  /* Inherits general .card styles */
  margin-bottom: 10px; /* Space between cards */
  /* Visibility controlled by JS */
}

#calculator-display-cards .card-title {
  /* Inherits general .card-title styles */
  font-size: 13px; /* Slightly smaller if needed */
  padding-bottom: 6px;
  margin-bottom: 10px;
}

#calculator-display-cards .card-content {
  padding: 5px; /* Add some padding inside the card */
  font-size: 13px;
  line-height: 1.5;
}

#car-description-content {
  /* Style for the description text area */
  white-space: pre-wrap; /* Preserve line breaks */
  max-height: 150px; /* Limit height and allow scroll */
  overflow-y: auto;
  background-color: rgba(40, 40, 40, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px;
}

/* Gallery Styling (Leverages shared_components.js structure) */
#car-images-gallery .image-gallery-main img, 
#dragy-proof-gallery .image-gallery-main img {
  max-width: 100%;
  height: auto;
  border: 1px solid #555;
  margin-bottom: 10px;
}

#car-images-gallery .image-gallery-thumbnails,
#dragy-proof-gallery .image-gallery-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#car-images-gallery .image-gallery-thumbnails img,
#dragy-proof-gallery .image-gallery-thumbnails img {
  width: 60px; /* Adjust size as needed */
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #666;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
}

#car-images-gallery .image-gallery-thumbnails img:hover,
#dragy-proof-gallery .image-gallery-thumbnails img:hover {
  opacity: 1;
  border-color: var(--primary-color);
}

#car-images-gallery .image-gallery-thumbnails img.active-thumbnail,
#dragy-proof-gallery .image-gallery-thumbnails img.active-thumbnail {
   border-color: var(--primary-color);
   opacity: 1;
   box-shadow: 0 0 5px var(--primary-color);
}

/* Placeholder text styling */
#car-images-gallery p,
#dragy-proof-gallery p {
  font-style: italic;
  font-size: 0.9em;
  color: #888;
  text-align: center;
}

/* Dragy Indicator Styling (assuming .dragy-indicator class added by JS) */
.dragy-indicator {
    /* For main image view if needed */
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    padding: 2px 5px;
    font-size: 10px;
    border-radius: 3px;
    font-weight: bold;
}

.dragy-indicator-thumb {
     /* For thumbnails */
    position: absolute;
    bottom: 2px;
    right: 2px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: bold;
}

/* =====================================================
   INPUT TYPE TOGGLE STYLES
   ===================================================== */

/* Two-state toggle container */
.input-type-toggle {
  display: flex;
  width: 100%;
  background: #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 15px;
  border: 1px solid #444;
}

.input-type-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-type-btn:hover {
  color: #bbb;
  background: rgba(255, 255, 255, 0.05);
}

.input-type-btn.active {
  background: #555;
  color: #ccc;
  box-shadow: 0 2px 8px rgba(85, 85, 85, 0.3);
}

/* Input mode sections */
.input-mode-section {
  transition: opacity 0.2s ease;
}

/* Grip slider - just a simple range input */
.grip-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #d32f2f 0%, #f57c00 25%, #fbc02d 50%, #689f38 75%, #1976d2 100%);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.grip-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #444;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.grip-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #444;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Grip feedback - italic text */
.grip-feedback {
  font-size: 13px;
  font-style: italic;
  color: #fff;
}

/* Grip values - Base and Effective grip display */
.grip-values-dev {
  display: flex;
  gap: 15px;
  font-size: 11px;
  color: #888;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  border: 1px solid #333;
}

.grip-values-dev span {
  display: flex;
  gap: 4px;
}

.grip-values-dev strong {
  color: #4caf50;
  font-weight: 600;
}


/* Power input row with value and type toggle */
.power-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.power-value-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  text-align: right;
}

.power-value-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Power type toggle (BHP/WHP) */
.power-type-toggle {
  display: flex;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #444;
}

.power-type-btn {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.power-type-btn:hover {
  color: #bbb;
  background: rgba(255, 255, 255, 0.05);
}

.power-type-btn.active {
  background: #555;
  color: #ccc;
}

.power-type-btn[data-type="whp"].active {
  background: #555;
  color: #ccc;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablets and smaller desktops (1200px and below) */
@media (max-width: 1200px) {
  .container {
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    padding: 8px;
  }
  
  .section {
    width: 100%;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    min-height: auto !important;
    height: auto !important;
  }
  
  #column-1, #column-2, #column-3 {
    width: 100%;
    max-width: 100% !important;
  }
  
  .card {
    min-height: auto;
    height: auto;
  }
}

/* Mobile devices (768px and below) */
@media (max-width: 768px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .main-content {
    padding-top: 60px;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
  
  .container {
    flex-direction: column;
    flex-wrap: wrap;
    padding: 6px;
    gap: 8px;
  }
  
  .section {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    min-height: auto !important;
    height: auto !important;
    margin-bottom: 8px;
  }
  
  #column-1, #column-2, #column-3 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    height: auto !important;
  }
  
  .card {
    min-height: auto !important;
    height: auto !important;
    padding: 12px;
  }
  
  .card-title {
    font-size: 14px;
  }
  
  /* Header adjustments */
  header {
    height: 55px;
    padding: 8px 10px;
  }
  
  .header-left h1 {
    font-size: 18px;
  }
  
  .header-right {
    gap: 8px;
  }
  
  .action-button {
    padding: 6px 12px;
    font-size: 13px;
  }
  
  /* Chart containers */
  #speedChartContainer,
  #accelerationChartContainer,
  #powerCurveContainer {
    height: 250px !important;
    min-height: 250px !important;
  }
  
  /* Form inputs */
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-group label {
    font-size: 13px;
  }
  
  .form-group input,
  .form-group select {
    font-size: 14px;
    padding: 8px;
  }
  
  /* Results display - tablet */
  .result-item {
    font-size: 12px;
    padding: 3px 0;
  }

  .result-name {
    font-size: 12px;
  }

  .result-value {
    font-size: 12px;
  }

  /* Spec bubbles - tablet */
  .spec-bubble {
    padding: 4px 8px;
    margin: 2px 2px;
    font-size: 11px;
    border-width: 1px;
  }

  .spec-value {
    font-size: 11px;
  }
  
  /* Modal adjustments */
  .modal-content {
    width: 95%;
    max-width: 95%;
    padding: 15px;
  }
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
  .main-content {
    padding-top: 55px;
  }
  
  .container {
    padding: 4px;
    gap: 6px;
  }
  
  .section {
    margin-bottom: 6px;
  }
  
  .card {
    padding: 10px;
  }
  
  .card-title {
    font-size: 13px;
  }
  
  header {
    height: 50px;
    padding: 6px 8px;
  }
  
  .header-left h1 {
    font-size: 16px;
  }
  
  .action-button {
    padding: 5px 10px;
    font-size: 12px;
  }
  
  /* Chart containers - smaller for tiny screens */
  #speedChartContainer,
  #accelerationChartContainer,
  #powerCurveContainer {
    height: 400px !important;
    min-height: 400px !important;
    max-height: 400px !important;
    padding: 4px !important;
  }

  .power-curve-chart-container {
    padding-left: 0 !important;
  }
  
  /* Input fields */
  .form-group input,
  .form-group select {
    font-size: 13px;
    padding: 6px;
  }
  
  /* Results display - small mobile */
  .result-item {
    font-size: 11px;
    padding: 3px 0;
  }

  .result-name {
    font-size: 10px;
  }

  .result-value {
    font-size: 11px;
  }

  /* Spec bubbles - small mobile */
  .spec-bubble {
    padding: 3px 6px;
    margin: 1px 1px;
    font-size: 10px;
    border-width: 1px;
  }

  .spec-value {
    font-size: 10px;
  }
  
  /* Button groups - Keep horizontal on mobile */
  .input-type-toggle,
  .power-type-toggle {
    flex-direction: row; /* Keep buttons side by side */
    flex-shrink: 0; /* Prevent shrinking */
    min-width: fit-content; /* Don't shrink below content size */
  }

  .input-type-btn,
  .power-type-btn {
    flex: 1; /* Equal width within their container */
    min-width: 0; /* Allow shrinking if needed */
    white-space: nowrap; /* Prevent text wrapping */
  }
}

/* Ensure scrolling works properly on all mobile devices */
@media (max-width: 768px) {
  html {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
  }
  
  body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
  
  .main-content {
    overflow-y: visible;
    overflow-x: hidden;
    height: auto;
    min-height: calc(100vh - 60px);
  }
  
  /* Remove fixed heights from all containers */
  * {
    max-height: none !important;
  }
  
  /* Except for charts which need some height */
  #speedChartContainer,
  #accelerationChartContainer,
  #powerCurveContainer {
    max-height: 300px !important;
  }
}
