/* =====================================================================
   TEZLAND CONFIGURATOR UI SYSTEM
   Minimal, modern, and cohesive design language inspired by tezland.is.
   ===================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --bg-elevated: #ffffff;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #eef2f8;

  --text: #111827;
  --text-2: #1f2937;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  --stroke: #d9e1ee;
  --stroke-strong: #c7d2e4;

  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --danger: #dc2626;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 20px 46px rgba(15, 23, 42, 0.14);

  --ease: cubic-bezier(0.2, 0.65, 0.2, 1);
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(37, 99, 235, 0.09), transparent 65%),
    radial-gradient(900px 420px at 90% -15%, rgba(29, 78, 216, 0.06), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* ========================= CAR MODEL SCREEN ========================= */
.car-model-screen {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.car-model-screen.hidden {
  display: none;
}

.car-model-screen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.44);
  backdrop-filter: blur(6px);
}

.car-model-screen-panel {
  position: relative;
  width: min(780px, 100%);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.car-model-screen-panel h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.car-model-screen-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.car-model-options {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.car-model-option {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.car-model-option:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
  box-shadow: var(--shadow-sm);
}

.car-model-option.selected {
  border-color: rgba(37, 99, 235, 0.55);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.car-model-option-title {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
}

.car-model-option-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.car-model-start {
  width: 100%;
  margin-top: 16px;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 170ms var(--ease), transform 170ms var(--ease), box-shadow 170ms var(--ease);
}

.car-model-start:hover:not(:disabled) {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.car-model-start:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================== HEADER ============================== */
.header {
  margin: 14px 14px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
  position: relative;
  z-index: 60;
}

.header-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.mobile-controls-toggle {
  display: none;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.mobile-controls-toggle:hover {
  border-color: var(--stroke-strong);
  background: #eaf0fa;
}

.header-controls-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hotspot-toggle,
.landscape-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.hotspot-toggle {
  cursor: pointer;
}

.hotspot-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  background: #dbe4f1;
  position: relative;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease);
}

.hotspot-toggle input::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  transform: translateY(-50%);
  transition: left 200ms var(--ease);
}

.hotspot-toggle input:checked {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.42);
}

.hotspot-toggle input:checked::after {
  left: 17px;
}

.landscape-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 26px 6px 10px;
  min-width: 120px;
  background:
    linear-gradient(180deg, #ffffff, #f3f6fc),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center / 10px 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  outline: none;
}

.landscape-select:focus-visible {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* ============================= LAYOUT ============================== */
.viewport-container {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 14px;
  padding: 14px;
  position: relative;
}

.car-viewer {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background:
    radial-gradient(1200px 480px at 50% -120px, rgba(37, 99, 235, 0.11), transparent 62%),
    linear-gradient(180deg, #edf2fb 0%, #e8eef8 100%);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

#3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========================== VIEWER ELEMENTS ========================= */
.viewer-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  min-width: 220px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

.viewer-loading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.viewer-help {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 95;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-xs);
  padding: 8px 12px;
  pointer-events: none;
}

.viewer-help p {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.viewer-copyright-warning {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 110;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-xs);
  padding: 4px 8px;
  cursor: default;
}

.viewer-copyright-warning p {
  margin: 0;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
}

.viewer-copyright-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 36px));
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: #ffffff;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  padding: 10px;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), visibility 160ms var(--ease);
}

.viewer-copyright-warning:hover .viewer-copyright-tooltip,
.viewer-copyright-warning:focus-within .viewer-copyright-tooltip,
.viewer-copyright-warning:focus-visible .viewer-copyright-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.under-seat-led-menu {
  position: absolute;
  left: 12px;
  top: 58px;
  z-index: 115;
  width: 170px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  padding: 10px;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), visibility 160ms var(--ease);
}

.under-seat-led-menu.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-8px);
}

.under-seat-led-menu h4 {
  margin: 0;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.under-seat-led-label {
  display: block;
  margin: 8px 0 6px;
  color: var(--text-muted);
  font-size: 11px;
}

.under-seat-led-color {
  width: 100%;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: #fff;
  cursor: pointer;
}

.under-seat-led-ambient {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================== HOTSPOTS ============================== */
.model-hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.model-hotspot-layer.hidden {
  display: none;
}

.model-hotspot {
  position: absolute;
  border: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
}

.model-hotspot-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.34), 0 8px 18px rgba(37, 99, 235, 0.22);
  border: 2px solid #ffffff;
  animation: hotspotPulse 1.9s ease-out infinite;
}

@keyframes hotspotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.34), 0 8px 18px rgba(37, 99, 235, 0.22);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(37, 99, 235, 0), 0 8px 18px rgba(37, 99, 235, 0.22);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 8px 18px rgba(37, 99, 235, 0.22);
  }
}

.model-hotspot-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  border: 1px solid var(--stroke);
  background: #ffffff;
  color: var(--text-muted);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  white-space: nowrap;
  padding: 8px 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms var(--ease), transform 150ms var(--ease);
}

.model-hotspot:hover .model-hotspot-tooltip,
.model-hotspot:focus-visible .model-hotspot-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.model-hotspot-name {
  display: block;
  color: var(--text-2);
  font-weight: 700;
}

.model-hotspot-count {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
}

/* ============================ PART SELECTOR ============================ */
.part-selector {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(98%, 1220px);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-md);
  border-radius: 999px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 130;
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}

.part-selector-divider {
  width: 1px;
  height: 28px;
  background: var(--stroke);
  margin: 0 4px;
}

.part-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 12px;
  padding: 7px 10px;
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  transition: color 150ms var(--ease), border-color 150ms var(--ease), background 150ms var(--ease), transform 150ms var(--ease);
}

.part-btn:hover {
  border-color: var(--stroke-strong);
  background: #f8fafc;
  color: var(--text-2);
  transform: translateY(-1px);
}

.part-btn.active,
.camera-btn.active,
.sub-btn.active {
  color: var(--primary-strong);
  border-color: rgba(37, 99, 235, 0.3);
  background: var(--primary-soft);
}

.part-btn-icon {
  font-size: 16px;
}

.part-btn.loading .part-btn-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid rgba(37, 99, 235, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin-left: 4px;
  animation: spin 0.6s linear infinite;
}

.part-btn.view-hidden {
  display: none;
}

.interior-subnav {
  display: none;
  align-items: center;
  justify-content: center;
  flex-basis: 100%;
  gap: 7px;
  padding-top: 6px;
}

.interior-subnav.visible {
  display: flex;
}

.sub-btn {
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms var(--ease);
}

.sub-btn:hover {
  border-color: var(--stroke-strong);
  color: var(--text-2);
}

/* ============================ BUILD SUMMARY ============================ */
.build-summary {
  width: 350px;
  min-width: 320px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.build-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.build-summary h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-soft);
}

.build-summary-toggle {
  display: none;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.build-items {
  margin-top: 12px;
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding-right: 4px;
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 26px 12px;
  color: var(--text-soft);
  text-align: center;
  font-size: 13px;
}

.build-item {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

.build-item:hover {
  border-color: var(--stroke-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.build-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.build-item-part {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.build-item-qty {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.build-item-qty > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.qty-btn:hover {
  background: #eef2f8;
  color: var(--text-2);
}

.qty-input {
  width: 36px;
  height: 24px;
  border: none;
  border-left: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
  text-align: center;
  color: var(--text-2);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.qty-input:focus {
  outline: none;
  background: #f8fafc;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.build-item-price {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}

.build-item-remove {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(220, 38, 38, 0.3);
  background: #fef2f2;
  color: var(--danger);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.build-item-remove:hover {
  background: #fee2e2;
}

.build-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.build-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.build-total span:last-child {
  color: var(--text-2);
  font-size: 24px;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.btn-checkout {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 12px;
  cursor: pointer;
  transition: background 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

.btn-checkout:hover:not(:disabled) {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

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

/* =============================== DRAWER =============================== */
.drawer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 220;
  height: 46vh;
  max-height: 560px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(100% + 20px));
  transition: transform 260ms var(--ease);
}

.drawer:not(.drawer-hidden) {
  transform: translateY(0);
}

.drawer-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--stroke);
  padding: 12px 14px;
  background: #ffffff;
}

.drawer-snap-toggle {
  display: none;
  width: 46px;
  height: 5px;
  border: none;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
}

.drawer-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-header h3 {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 800;
}

.drawer-status {
  min-height: 14px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}

.btn-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.btn-close:hover {
  color: var(--text-2);
  border-color: var(--stroke-strong);
}

.product-grid {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
}

.product-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: transform 170ms var(--ease), border-color 170ms var(--ease), box-shadow 170ms var(--ease);
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
  box-shadow: var(--shadow-sm);
}

.product-card.selected {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.product-card.selected::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px #ffffff;
}

.product-card.is-loading {
  opacity: 0.52;
  pointer-events: none;
}

.product-card.is-unavailable {
  opacity: 0.74;
}

.product-image {
  width: 100%;
  height: 122px;
  object-fit: cover;
  background: #edf2fa;
}

.product-info {
  min-height: 104px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.product-coming-soon {
  width: fit-content;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
}

.product-coming-soon-note {
  color: var(--text-soft);
  font-size: 10px;
}

.product-desc {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.product-price {
  margin-top: auto;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 800;
}

.product-qty {
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

.product-qty-btn {
  width: 25px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.product-qty-btn:hover {
  background: #e9f0fc;
  color: var(--text-2);
}

.product-qty-btn:disabled,
.product-qty-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.product-qty-input {
  width: 36px;
  height: 24px;
  border: none;
  border-left: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.product-qty-input:focus {
  outline: none;
  background: #ffffff;
}

/* ============================= WELCOME ============================= */
.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 510;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.welcome-modal.hidden {
  display: none;
}

.welcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 19, 34, 0.46);
  backdrop-filter: blur(5px);
}

.welcome-card {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100vh - 30px);
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: welcomeIn 240ms var(--ease);
}

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

.welcome-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.welcome-close:hover {
  color: var(--text-2);
}

.welcome-card h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  margin: 8px 0 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.welcome-tutorial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.welcome-step {
  margin: 0;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.welcome-step img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eaf0fa;
}

.welcome-step figcaption {
  padding: 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.welcome-confirm {
  width: 100%;
  margin-top: 16px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 12px;
  cursor: pointer;
}

.welcome-confirm:hover {
  background: var(--primary-strong);
}

/* ============================ SCROLLBARS ============================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  background: #cbd5e1;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: padding-box;
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1220px) {
  .build-summary {
    width: 320px;
    min-width: 300px;
  }
}

@media (max-width: 900px) {
  .viewport-container {
    display: block;
    padding: 10px;
  }

  .car-viewer {
    height: calc(100vh - 200px);
    min-height: 360px;
  }

  .build-summary {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 235;
    width: auto;
    min-width: 0;
    max-height: 62vh;
    transform: translateY(calc(100% - 74px));
    transition: transform 240ms var(--ease);
  }

  .build-summary.mobile-open {
    transform: translateY(0);
  }

  .build-summary-toggle {
    display: inline-flex;
  }

  .build-items {
    max-height: 30vh;
  }

  .drawer {
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 56vh;
  }

  .drawer.drawer-snap-collapsed {
    height: 34vh;
  }

  .drawer.drawer-snap-mid {
    height: 56vh;
  }

  .drawer.drawer-snap-full {
    height: 84vh;
  }

  .drawer-snap-toggle {
    display: inline-block;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .part-selector {
    width: calc(100% - 16px);
    bottom: 10px;
    border-radius: 18px;
    justify-content: center;
    padding: 7px;
    gap: 4px;
  }

  .part-selector-divider {
    display: none;
  }

  .part-btn {
    min-width: 54px;
    padding: 6px 8px;
  }

  .part-btn-icon {
    font-size: 15px;
  }

  .part-btn span:last-child {
    font-size: 10px;
  }

  .interior-subnav {
    border-top: 1px solid var(--stroke);
    padding-top: 8px;
  }

  body.mobile-build-open .part-selector,
  body.mobile-drawer-open .part-selector {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(8px);
  }

  .viewer-help {
    bottom: 88px;
  }
}

@media (max-width: 768px) {
  .header {
    margin: 10px 10px 0;
    padding: 8px;
  }

  .header-controls {
    justify-content: space-between;
  }

  .mobile-controls-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-controls-group {
    position: absolute;
    left: 8px;
    right: 8px;
    top: calc(100% + 8px);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    padding: 8px;
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 20;
  }

  body.mobile-controls-open .header-controls-group {
    display: flex;
  }

  .hotspot-toggle,
  .landscape-control {
    width: 100%;
    justify-content: space-between;
  }

  .landscape-select {
    width: 130px;
  }

  .viewer-copyright-warning p {
    font-size: 9px;
  }

  .under-seat-led-menu {
    width: 142px;
  }

  .welcome-tutorial-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Legacy view controls intentionally hidden; camera controls now live in part rail */
.view-toggle,
.view-btn {
  display: none;
}
