/* Goblin V2 Build & Price configurator
   Palette/tokens reused from styles.css + status-v2.css:
   bg #2b2b2b, cards #1f1f1f, borders #3a3a3a, green #52cc29 / #74dc52,
   text #efefef / #e2e2e2, muted #bcbcbc. */

.cfg-page {
  color: #efefef;
  padding-bottom: 3rem;
}

/* --- Hero (mirrors .status-v2-hero) --- */
.cfg-hero {
  padding-top: 5rem;
  padding-bottom: 4rem;
  background: linear-gradient(150deg, #171717 0%, #262626 48%, #1f2f1a 100%);
  border-bottom: 1px solid #3a3a3a;
}

#configuratorHero,
#configuratorHero.hero-section {
  height: auto;
  min-height: 200px;
  padding-top: 1.75rem;
  padding-bottom: 1.5rem;
}

#configuratorHero .overview-row {
  min-height: 0;
}

.cfg-hero-sub {
  color: #cfcfcf;
  margin-bottom: 0;
  font-size: 1.05rem;
}

/* --- Sections --- */
.cfg-section {
  padding-top: 2rem;
  padding-bottom: 0.5rem;
}

.cfg-intro {
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  line-height: 1.6;
}

.cfg-intro-title {
  margin-bottom: 0.6rem;
  font-size: 1.4rem;
}

.cfg-intro-list {
  margin: 0.5rem 0 0.85rem;
  padding-left: 1.2rem;
}

.cfg-intro-list li {
  margin-bottom: 0.4rem;
}

.cfg-intro strong {
  color: #74dc52;
}

.cfg-intro-note {
  margin-bottom: 0;
  color: #bcbcbc;
}

.cfg-empty-state {
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  color: #bcbcbc;
}

.cfg-empty-state p {
  margin: 0;
}

/* --- Two-column layout (form + sticky summary on desktop) --- */
.cfg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 992px) {
  .cfg-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }
}

/* --- Stage blocks --- */
.cfg-stage {
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 1.25rem 1.3rem;
  margin-bottom: 1.5rem;
}

.cfg-stage:last-child {
  margin-bottom: 0;
}

.cfg-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  border-bottom: 1px solid #3a3a3a;
  padding-bottom: 0.7rem;
  margin-bottom: 0.7rem;
}

.cfg-stage-title {
  margin: 0;
  font-size: 1.55rem;
}

.cfg-stage-base {
  color: #bcbcbc;
  font-size: 0.95rem;
}

.cfg-stage-base strong {
  color: #efefef;
}

.cfg-stage-blurb {
  color: #bcbcbc;
  line-height: 1.55;
  margin-bottom: 1.1rem;
}

/* --- Option groups --- */
.cfg-group {
  border: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.cfg-group:last-child {
  margin-bottom: 0;
}

.cfg-group-legend {
  float: none;
  width: auto;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #74dc52;
  margin-bottom: 0.55rem;
  padding: 0;
}

.cfg-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* --- Individual option (tap target) --- */
.cfg-option {
  display: block;
  min-height: 52px;
  padding: 0.65rem 0.85rem;
  background: #262626;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
  margin: 0;
}

.cfg-option:hover {
  border-color: #4b6242;
  background: #2b2b2b;
}

/* Top row: control + name + price */
.cfg-option-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

/* Detail row: thumbnail floated left, description wrapping against it */
.cfg-option-detail {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid #3a3a3a;
}

.cfg-option-detail::after {
  content: "";
  display: block;
  clear: both;
}

.cfg-option-thumb-btn {
  float: left;
  width: clamp(100px, 40%, 145px);
  padding: 0;
  border: 0;
  background: none;
  margin: 0 0.75rem 0.4rem 0;
  cursor: zoom-in;
  line-height: 0;
  border-radius: 8px;
}

.cfg-option-thumb-btn:focus-visible {
  outline: 2px solid #74dc52;
  outline-offset: 2px;
}

.cfg-option-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
  background: #1b1b1b;
  display: block;
  transition: border-color 0.15s ease;
}

.cfg-option-thumb-btn:hover .cfg-option-thumb {
  border-color: #74dc52;
}

/* --- Lightbox / modal --- */
.cfg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.cfg-lightbox[hidden] {
  display: none;
}

.cfg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.cfg-lightbox-dialog {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cfg-lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #1b1b1b;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.cfg-lightbox-caption {
  margin: 0.75rem 0 0;
  color: #e2e2e2;
  font-size: 0.95rem;
  text-align: center;
}

.cfg-lightbox-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid #3a3a3a;
  background: #1f1f1f;
  color: #efefef;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.cfg-lightbox-close:hover,
.cfg-lightbox-close:focus-visible {
  background: #52cc29;
  border-color: #52cc29;
  color: #000;
}

body.cfg-lightbox-open {
  overflow: hidden;
}

.cfg-option-desc {
  display: block;
  color: #bcbcbc;
  font-size: 0.88rem;
  line-height: 1.5;
}

.cfg-input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #52cc29;
  cursor: pointer;
  margin: 0;
}

.cfg-option-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
  color: #ededed;
}

.cfg-option-price {
  flex: 0 0 auto;
  font-weight: 700;
  color: #74dc52;
  font-size: 0.95rem;
  white-space: nowrap;
}

.cfg-option-price.is-zero {
  color: #9d9d9d;
}

/* Highlight the selected option */
.cfg-option:has(.cfg-input:checked) {
  border-color: #52cc29;
  background: rgba(82, 204, 41, 0.1);
  box-shadow: inset 0 0 0 1px rgba(82, 204, 41, 0.35);
}

/* Keyboard focus visibility */
.cfg-input:focus-visible {
  outline: 2px solid #74dc52;
  outline-offset: 2px;
}

/* --- Summary / breakdown --- */
.cfg-summary-inner {
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 1.1rem 1.15rem 1.25rem;
}

@media (min-width: 992px) {
  .cfg-summary {
    position: sticky;
    top: calc(var(--nav-h) + 1rem);
  }
}

.cfg-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.cfg-summary-title {
  font-size: 1.25rem;
  margin: 0;
}

.cfg-reset {
  flex: 0 0 auto;
  background: transparent;
  color: #bcbcbc;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}

.cfg-reset:hover,
.cfg-reset:focus-visible {
  border-color: #52cc29;
  color: #74dc52;
  background: rgba(82, 204, 41, 0.1);
}

.cfg-reset:focus-visible {
  outline: 2px solid #74dc52;
  outline-offset: 2px;
}

.cfg-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cfg-panel {
  background: #262626;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  overflow: hidden;
}

.cfg-panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #ededed;
}

.cfg-panel-summary::-webkit-details-marker {
  display: none;
}

.cfg-panel-summary::after {
  content: "\25BC";
  font-size: 0.7rem;
  color: #9d9d9d;
  order: 3;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
}

.cfg-panel[open] .cfg-panel-summary::after {
  transform: rotate(180deg);
  color: #74dc52;
}

.cfg-panel-name {
  flex: 1 1 auto;
}

.cfg-panel-subtotal {
  color: #74dc52;
  white-space: nowrap;
}

.cfg-panel-body {
  padding: 0.25rem 0.9rem 0.75rem;
  border-top: 1px solid #3a3a3a;
}

.cfg-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.32rem 0;
  font-size: 0.92rem;
  color: #d2d2d2;
  border-bottom: 1px solid #2f2f2f;
}

.cfg-line:last-child {
  border-bottom: none;
}

.cfg-line-empty {
  color: #9d9d9d;
  font-style: italic;
}

.cfg-line-price {
  white-space: nowrap;
  color: #ededed;
}

/* --- Grand total --- */
.cfg-grand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 2px solid #3a3a3a;
}

.cfg-grand-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: #efefef;
}

.cfg-grand-total {
  font-size: 1.7rem;
  font-weight: 700;
  color: #74dc52;
  line-height: 1.1;
}

.cfg-disclaimer {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: #9d9d9d;
  line-height: 1.4;
}

/* --- Save as PDF button --- */
.cfg-pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.7rem 1rem;
  background: #52cc29;
  color: #04210a;
  border: 1px solid #52cc29;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.cfg-pdf-btn:hover,
.cfg-pdf-btn:focus-visible {
  background: #5fe030;
  border-color: #5fe030;
}

.cfg-pdf-btn:focus-visible {
  outline: 2px solid #74dc52;
  outline-offset: 2px;
}

/* --- Print-only build summary --- */
/* Hidden on screen; revealed (and the rest of the page hidden) when printing. */
.cfg-print-summary {
  display: none;
}

@media print {
  /* Hide the live page chrome and interactive UI. */
  nav.navbar,
  footer,
  .cfg-hero,
  .cfg-page,
  #cfgLightbox {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }

  .cfg-print-summary {
    display: block;
    color: #111;
    font-family: "Lato", Arial, sans-serif;
    font-size: 0.85rem;
    padding: 0;
  }

  @page {
    margin: 1.5cm;
  }

  .cps-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 2px solid #52cc29;
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
  }

  .cps-logo {
    height: 32px;
    width: auto;
  }

  .cps-header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #111;
  }

  .cps-date {
    margin: 0 0 0 auto;
    font-size: 0.78rem;
    color: #555;
    white-space: nowrap;
  }

  .cps-stage {
    margin-bottom: 1.1rem;
    page-break-inside: avoid;
  }

  .cps-stage-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.25rem;
    margin-bottom: 0.4rem;
  }

  .cps-stage-head h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #111;
  }

  .cps-stage-subtotal {
    font-weight: 700;
    color: #111;
  }

  /* Indent line items under the stage title to set them apart. Prices stay
     flush right; the bold stage subtotal in the header reads as the total. */
  .cps-opt,
  .cps-empty {
    padding-left: 1rem;
  }

  .cps-opt {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.26rem;
    padding-bottom: 0.26rem;
    border-bottom: 1px solid #eee;
    page-break-inside: avoid;
  }

  .cps-opt-name {
    color: #111;
  }

  .cps-opt-price {
    white-space: nowrap;
    font-weight: 400;
    color: #333;
  }

  .cps-empty {
    font-size: 0.85rem;
    font-style: italic;
    color: #777;
    margin: 0.25rem 0;
  }

  .cps-grand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.6rem;
    border-top: 2px solid #52cc29;
    font-size: 1.15rem;
    font-weight: 700;
    color: #111;
  }

  .cps-grand span:last-child {
    color: #111;
  }

  .cps-disclaimer {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #777;
  }

  /* Make sure photos and accent colors actually print. */
  .cfg-print-summary,
  .cfg-print-summary * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
