/* ============================================================
   Variables
   ============================================================ */
:root {
  --navy:        #1A2C40;
  --navy-mid:    #2E4D6B;
  --navy-light:  #3A6491;
  --gold:        #C9A84C;
  --gold-dark:   #A8832A;
  --bg:          #F2F0EC;
  --surface:     #FFFFFF;
  --border:      #E0DCD6;
  --border-dark: #C8C3BB;
  --text:        #1A1A1A;
  --text-mid:    #555555;
  --text-light:  #888888;
  --placeholder: #CCC9C2;
  --danger:      #C0392B;

  --progress-h:  54px;
  --radius:      6px;
  --radius-lg:   10px;
  --ease:        0.18s ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ============================================================
   App Shell
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* ============================================================
   Progress Bar
   ============================================================ */
#progress-bar {
  display: flex;
  height: var(--progress-h);
  background: var(--navy);
  flex-shrink: 0;
  user-select: none;
}

.progress-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 3px solid transparent;
  padding: 0 6px;
  transition: color var(--ease), border-color var(--ease);
  position: relative;
}

.progress-step + .progress-step::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-step.completed {
  color: rgba(255, 255, 255, 0.55);
  border-bottom-color: rgba(201, 168, 76, 0.35);
}

.progress-step.active {
  color: #FFFFFF;
  border-bottom-color: var(--gold);
}

.progress-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  transition: background var(--ease);
}

.progress-step.active .progress-step-num {
  background: var(--gold);
  color: var(--navy);
}

.progress-step.completed .progress-step-num {
  background: rgba(201, 168, 76, 0.35);
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================================
   Main Content — two-column layout
   ============================================================ */
#main-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   Viewport Panel (left 2/3)
   ============================================================ */
#viewport-panel {
  flex: 2;
  min-width: 0;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

#viewport {
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}

/* ---- Render containers ---- */
.render-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.layer-placeholder {
  position: absolute;
  inset: 0;
  background: #ffffff;
}

.layer-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- Split layout (bathroom) ---- */
#viewport.render-split .split-half {
  flex: 1;
  display: flex;
  min-width: 0;
}

#viewport.render-split .split-half--left {
  border-right: 2px solid var(--border-dark);
}

/* ============================================================
   Price Badge
   ============================================================ */
#price-badge {
  position: absolute;
  bottom: 22px;
  right: 22px;
  background: rgba(26, 44, 64, 0.90);
  color: #FFFFFF;
  padding: 11px 22px;
  border-radius: var(--radius-lg);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
  z-index: 20;
  pointer-events: none;
}

/* ============================================================
   Options Panel (right 1/3)
   ============================================================ */
#options-panel {
  flex: 1;
  max-width: 400px;
  min-width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#options-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 22px 16px;
  scroll-behavior: smooth;
}

#options-scroll::-webkit-scrollbar { width: 5px; }
#options-scroll::-webkit-scrollbar-track { background: transparent; }
#options-scroll::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }

#step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--gold);
}

/* ============================================================
   Option Groups
   ============================================================ */
.option-group {
  margin-bottom: 22px;
}

.option-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-light);
  margin-bottom: 9px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 5px;
  background: transparent;
  text-align: left;
  transition: border-color var(--ease), background var(--ease);
  font-family: inherit;
  font-size: 13px;
}

.option-item:hover {
  border-color: var(--navy-light);
  background: #F5F7FA;
}

.option-item.selected {
  border-color: var(--navy);
  background: #EEF3F9;
}

/* Custom radio dot */
.option-radio {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-dark);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--ease), background var(--ease);
}

.option-item.selected .option-radio {
  border-color: var(--navy);
  background: var(--navy);
}

.option-item.selected .option-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFFFFF;
}

.option-label {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
}

.option-item.selected .option-label {
  color: var(--navy);
  font-weight: 600;
}

.option-price {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
}

.option-price.has-price {
  color: var(--gold-dark);
  font-weight: 700;
}

/* ============================================================
   Navigation Buttons
   ============================================================ */
#nav-buttons {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}

.nav-right {
  display: flex;
  gap: 8px;
}

.btn {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--navy);
  color: #FFFFFF;
  border: 1.5px solid var(--navy);
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-mid);
  border-color: var(--navy-mid);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
  background: #FDF2F1;
}

.btn-pdf {
  background: var(--gold);
  color: var(--navy);
  border: 1.5px solid var(--gold);
}

.btn-pdf:hover:not(:disabled) {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 1024px) {
  .progress-step-label { display: none; }

  #price-badge {
    font-size: 20px;
    padding: 9px 16px;
    bottom: 14px;
    right: 14px;
  }

  #options-panel {
    max-width: 300px;
    min-width: 220px;
  }
}

/* ============================================================
   Responsive — Small tablet / large phone (stacked layout)
   ============================================================ */
@media (max-width: 720px) {
  body { overflow: auto; }

  #app {
    height: auto;
    min-height: 100vh;
  }

  #main-content {
    flex-direction: column;
    overflow: visible;
  }

  #viewport-panel {
    flex: none;
    height: 56vw;
    min-height: 220px;
  }

  #options-panel {
    flex: none;
    width: 100%;
    max-width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #options-scroll {
    max-height: 60vh;
  }
}

/* ============================================================
   Print Overlay (hidden normally, shown when printing)
   ============================================================ */
#print-overlay {
  display: none;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    height: auto;
    overflow: auto;
    background: #FFFFFF;
  }

  #app {
    display: none !important;
  }

  #print-overlay {
    display: block !important;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #1A1A1A;
  }
}

/* ---- Print document layout ---- */
.pr-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 32px;
}

.pr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 3px solid #1A2C40;
}

.pr-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1A2C40;
  margin-bottom: 4px;
}

.pr-date {
  font-size: 12px;
  color: #888888;
}

.pr-header-right {
  text-align: right;
}

.pr-total-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888888;
  margin-bottom: 2px;
}

.pr-total {
  font-size: 28px;
  font-weight: 700;
  color: #1A2C40;
}

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr-table th {
  background: #1A2C40;
  color: #FFFFFF;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pr-th-price { text-align: right; }

.pr-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #EDEAE5;
  vertical-align: middle;
}

.pr-step-header td {
  background: #F2F0EC;
  font-weight: 700;
  font-size: 12px;
  color: #1A2C40;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 9px 12px;
  border-bottom: none;
}

.pr-group {
  color: #555555;
  width: 38%;
}

.pr-value {
  color: #1A1A1A;
  font-weight: 500;
}

.pr-price {
  text-align: right;
  color: #A8832A;
  font-weight: 600;
  white-space: nowrap;
}

.pr-separator td {
  padding: 6px;
  border-bottom: 2px solid #1A2C40;
}

.pr-base td {
  background: #F5F4F0;
  color: #555555;
  font-size: 13px;
}

.pr-final td {
  background: #1A2C40;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 15px;
}

.pr-final .pr-price {
  color: #C9A84C;
}
