/* ===== CSS VARIABLES ===== */
:root {
  --bg: #dad0c766;
  --card: #ffffff;
  --primary: #6A704C;
  --primary-hover: #4D321F;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #ddd;
  --wood: #e8d4a0;
  --wood-dark: #dcc48e;
  --wood-stroke: #b08840;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 14px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}


/* ===== APP LAYOUT ===== */
#app {
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem 0;
}


/* ===== PROGRESS BAR ===== */
#progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background 0.2s;
  font-size: 0.85rem;
  white-space: nowrap;
}
.progress-step:hover { background: rgba(37,99,235,0.06); }
.progress-step .num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.8rem;
  background: var(--border);
  color: var(--text-light);
  transition: all 0.3s;
  flex-shrink: 0;
}
.progress-step.active .num {
  background: var(--primary);
  color: #fff;
}
.progress-step.completed .num {
  background: var(--primary);
  color: #fff;
}
.progress-step .label { color: var(--text-light); transition: color 0.3s; }
.progress-step.active .label { color: var(--text); font-weight: 600; }
.progress-connector {
  width: 40px; height: 2px;
  background: var(--border);
  flex-shrink: 0;
}
.progress-connector.completed { background: var(--primary); }

/* ===== MAIN TWO-COLUMN ===== */
main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  margin-bottom: 1.5rem;
}

/* ===== CONTROLS PANEL ===== */
#controls {
  background: var(--card);
border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
/* ===== PRESET CARDS ===== */
#preset-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.preset-card:hover {
  border-color: var(--primary);
  background: #f0f5ff;
}
.preset-card.active {
  border-color: var(--primary);
  background: #eff6ff;
}
.preset-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text);
}
.preset-dims {
  font-size: 0.75rem;
  color: var(--text-light);
}

.step-panel { display: none; }
.step-panel.active { display: block; }
.step-panel h2 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}
.step-panel .step-desc {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* ===== FORM CONTROLS ===== */
.control-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #f4f4f4;
}

.step-panel > .control-group::nth-last-child(1) {
  border-bottom: none;
}
.control-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.stepper button {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--card);
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.stepper button:hover {
  background: #f0f5ff;
}
.stepper button:active {
  background: #e0eaff;
}
.stepper input[type="number"] {
  width: 60px;
  height: 30px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 13px;
  text-align: center;
  color: var(--text);
  background: var(--card);
  -moz-appearance: textfield;
}
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper input[type="number"]:focus {
  outline: none;
  background: #f8faff;
}
.quantity-price-block {
  margin-bottom: 1.5rem;
  /* padding-bottom: 1rem;
  border-bottom: 1px solid var(--border); */
}
.quantity-price-block h2 {
  margin-bottom: 30px;
}
.fixed-dims {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: #f8f9fb;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
}
.computed-value {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f0f9ff;
  border-radius: 8px;
  font-size: 18px;
  text-align: center;
  color: #000;
  font-weight: 500;
}

/* ===== SUMMARY TOGGLE ===== */
.summary-toggle {
  padding: 15px 20px;
  margin-bottom: 1.5rem;
  cursor: pointer;
  background: #f4f4f4;
  border-radius: 8px;
}

.summary-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.summary-toggle h2 {
  
}

.summary-toggle p.step-desc {
  margin-bottom: 0;
}

.toggle-arrow {
  font-size: 17px;
  transition: transform 0.2s;
  display: inline-block;
}
.summary-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}
.summary-toggle .summary-table {
  display: none;
}
.summary-toggle.open .summary-table {
  margin-top: 1.5rem;
  display: table;
}

/* ===== PREVIEW PANEL ===== */
#preview {
  position: relative;
  padding: 0;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}
#preview h3 {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
#preview svg {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}
.view-panel { display: none; }
.view-panel.active { 
  display: block; 
  
}
#canvas3d {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #e8ecf1 0%, #f8f9fb 50%, #e2e6eb 100%);
  cursor: grab;
  -webkit-border-top-left-radius: var(--radius);
-webkit-border-bottom-left-radius: var(--radius);
-moz-border-radius-topleft: var(--radius);
-moz-border-radius-bottomleft: var(--radius);
border-top-left-radius: var(--radius);
border-bottom-left-radius: var(--radius);

  box-shadow: var(--shadow);
}
#canvas3d:active { cursor: grabbing; }
.preview-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== FOOTER NAV ===== */
#nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.nav-btn.secondary:hover { border-color: var(--primary); color: var(--primary); }
.nav-btn.primary {
  background: var(--primary);
  color: #fff;
}
.nav-btn.primary:hover { background: var(--primary-hover); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-btn.hidden { visibility: hidden; }

/* ===== SUMMARY (STEP 4) ===== */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.summary-table th,
.summary-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.summary-table th {
  font-weight: 500;
  color: var(--text-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.summary-table td:last-child {
  font-weight: 600;
  text-align: right;
}

/* ===== ADD TO CART BUTTON ===== */
.btn-add-cart {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s;
  margin-top: 1rem;
}
.btn-add-cart:hover {
  background: var(--primary-hover);
}

/* ===== 3D PERSPECTIVE TOGGLE ===== */
.view-tabs {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0;
}
.view-tab {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--text-light);
  font-weight: 500;
}
.view-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== PRINT STYLES ===== */
@media print {
  #responsive-warning, header, #progress, #controls, #nav-buttons { display: none !important; }
  main { grid-template-columns: 1fr; }
  #preview { box-shadow: none; border: none; }
}

/* ===== CUSTOM DIMENSIONS MODAL ===== */
#custom-dims-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.custom-dims-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.custom-dims-dialog {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(420px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.custom-dims-dialog h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.custom-dims-dialog p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: -0.5rem;
}
.custom-dims-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}
