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

@font-face {
  font-family: 'Steel';
  src: url('../steel/steel-steel-700.ttf') format('truetype');
  font-weight: 700;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #030712;
  color: #ffffff;
}

/* Full Screen Canvas */
#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
}

#canvas canvas {
  width: 100% !important;
  height: 100% !important;
  pointer-events: auto;
}

/* Loading Screen */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #030712;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

#loading.fade-out {
  opacity: 0;
  pointer-events: none;
  display: none;
}

#loading-content {
  text-align: center;
}

#loading-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
  color: #ffffff;
}

#progress-bar {
  width: 280px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

#progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.2s ease;
  border-radius: 3px;
}

/* Top Navigation */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 100;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.nav-back:hover {
  color: #ffffff;
}

.nav-back svg {
  width: 18px;
  height: 18px;
}

.title {
  font-family: 'Steel', sans-serif;
  font-size: 20px;
  letter-spacing: 0.1em;
  color: #ffffff;
}

.price-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.price-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#total-price {
  font-size: 18px;
  font-weight: 700;
  color: #60a5fa;
}

/* Step Progress */
#step-progress {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(10px);
  z-index: 99;
}

.progress-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.4s ease;
  width: 8.33%;
}

/* Config Panel */
#config-panel {
  position: fixed;
  bottom: 80px;
  left: 0;
  right: 0;
  height: 220px;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(to top, rgba(3, 7, 18, 0.95) 0%, rgba(3, 7, 18, 0.8) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 50;
}

.config-step {
  display: none;
  animation: fadeIn 0.3s ease;
}

.config-step.active {
  display: block;
}

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

/* Step Header */
.step-header {
  text-align: center;
  margin-bottom: 20px;
}

.step-number {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.step-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-description {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* Options Grid (for build materials) */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Options List */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.options-list.compact {
  max-height: 100px;
}

/* Dropdown Styles */
.dropdown-container {
  max-width: 500px;
  margin: 0 auto;
}

.config-dropdown {
  width: 100%;
  padding: 16px 20px;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #ffffff;
  font-size: 15px;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 20px;
  transition: all 0.2s ease;
}

.config-dropdown:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(17, 24, 39, 0.9);
}

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

.config-dropdown option {
  background: #111827;
  color: #ffffff;
  padding: 12px;
}

/* Option Card */
.option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-card:hover {
  background: rgba(17, 24, 39, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}

.option-card:has(input:checked) {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.option-card input {
  display: none;
}

.option-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.option-title {
  font-weight: 500;
  font-size: 14px;
  flex: 1;
  min-width: 120px;
}

.option-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  width: 100%;
}

.option-price {
  font-size: 13px;
  color: #60a5fa;
  font-weight: 500;
}

/* Color Grid */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.color-option {
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.color-option:hover {
  background: rgba(17, 24, 39, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}

.color-option:has(input:checked) {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.color-option input {
  display: none;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-name {
  font-size: 12px;
  font-weight: 500;
}

.color-price {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* Checkbox Cards */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-card.featured {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.checkbox-card:hover {
  background: rgba(17, 24, 39, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}

.checkbox-card:has(input:checked) {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.checkbox-card:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* Options Section */
.options-section {
  margin-top: 20px;
}

.options-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.trailer-upgrades {
  opacity: 0.5;
  pointer-events: none;
  transition: all 0.3s ease;
}

.trailer-upgrades.enabled {
  opacity: 1;
  pointer-events: auto;
}

/* Summary */
#summary-content {
  background: rgba(17, 24, 39, 0.6);
  border-radius: 12px;
  padding: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.summary-value {
  font-weight: 500;
  font-size: 13px;
}

.summary-total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-total .label {
  font-size: 16px;
  font-weight: 600;
}

.summary-total .price {
  font-size: 24px;
  font-weight: 700;
  color: #60a5fa;
}

.submit-btn {
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.35);
}

/* Step Navigation */
#step-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(3, 7, 18, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 60;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.nav-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: transparent;
}

.nav-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

/* Controls Help */
#controls-help {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  z-index: 40;
  pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Desktop Enhancements - keep panel at bottom but wider */
@media (min-width: 768px) {
  #config-panel {
    height: 240px;
    padding: 24px 40px;
  }

  #step-nav {
    padding: 0 40px;
  }

  .title {
    font-size: 24px;
  }

  #total-price {
    font-size: 22px;
  }

  .options-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 800px;
    margin: 0 auto;
  }

  .options-list {
    max-width: 600px;
    margin: 0 auto;
  }

  .color-grid {
    max-width: 700px;
    margin: 0 auto;
  }

  .step-header {
    max-width: 600px;
    margin: 0 auto 20px;
  }
}

/* Large Desktop */
@media (min-width: 1200px) {
  #config-panel {
    height: 240px;
    padding: 24px 60px;
  }

  .options-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
  }

  .color-grid {
    max-width: 900px;
  }

  .options-list {
    max-width: 700px;
  }
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  #top-nav {
    padding: 0 12px;
  }

  .title {
    font-size: 16px;
  }

  #total-price {
    font-size: 16px;
  }

  #config-panel {
    padding: 16px;
    height: 200px;
  }

  .step-header h2 {
    font-size: 20px;
  }

  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .color-grid {
    max-width: 100%;
  }

  .color-option {
    width: 90px;
  }

  .nav-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Scene Settings Toggle Button */
#scene-toggle {
  position: fixed;
  top: 100px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: #1e3a5f;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  color: #60a5fa;
  cursor: pointer;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: auto !important;
  transition: all 0.2s ease;
}

#scene-toggle:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  transform: scale(1.05);
}

#scene-toggle svg {
  width: 22px;
  height: 22px;
}

/* Scene Settings Panel */
#scene-panel {
  position: fixed;
  top: 160px;
  right: 20px;
  width: 280px;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  z-index: 10000;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
  pointer-events: auto !important;
}

#scene-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.95);
}

.scene-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.scene-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

#scene-close {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

#scene-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.scene-controls {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scene-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-group label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: space-between;
}

.scene-group label span {
  color: #60a5fa;
  font-weight: 500;
}

.scene-group input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
}

.scene-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.scene-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.scene-group input[type="color"] {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.scene-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.scene-group input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.scene-presets {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.preset-btn {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #ffffff;
}

/* Mobile adjustments for scene panel */
@media (max-width: 480px) {
  #scene-panel {
    right: 10px;
    left: 10px;
    width: auto;
    top: 150px;
  }

  #scene-toggle {
    right: 10px;
    top: 100px;
  }
}
