/* ===== Page-level full-height & theme skin ===== */
html, body { height: 100%; margin: 0; }
#product-builder-app, .builder-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 800px at 10% -10%, #182446 0%, #0b1220 45%, #0b1220 100%);
  color: #eef3ff;
}

/* Shared wrapper */
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ===== Hero ===== */
.builder-hero {
  position: relative;
  border-bottom: 1px solid #22304d;
  background: linear-gradient(180deg, #0b1220cc, #0b122000);
}
.hero-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #4f7cff, #62e8c6);
  display: grid; place-items: center;
  font-weight: 800; color:#081224;
  box-shadow: 0 10px 24px rgba(79,124,255,.26);
}
.title { margin: 0; font-size: clamp(26px, 3vw, 34px); color: #fff; }
.tagline { margin: 4px 0 0; color: #9fb0d0; font-size: 14px; }

/* ===== Main builder area fills space ===== */
.builder-container { 
  flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 0 40px;
}

/* ===== Connector selection ===== */
.connector-selection { width: 100%; color:#eef3ff; }
.connector-selection h2 { margin: 10px 0; color:#fff; }

.select-box {
  width: 100%;
  max-width: 420px;
  background: #0f1930;
  color: #eef3ff;
  border: 1px solid #22304d;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
.select-box:focus { box-shadow: 0 0 0 4px rgba(128,160,255,.4); }

.connector-list {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start;
  margin-top: 14px;
  background: linear-gradient(180deg, #121a2b, #0e1728);
  border: 1px solid #22304d;
  border-radius: 14px;
  padding: 10px;
  height: 30vh;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #324569 #0e172b;
}
.connector-list::-webkit-scrollbar { width: 10px; height: 10px; }
.connector-list::-webkit-scrollbar-thumb { background: #324569; border-radius: 10px; }
.connector-list::-webkit-scrollbar-track { background: #0e172b; }

.connector-item {
  cursor: grab;
  padding: 10px 8px; margin: 4px;
  background: #0f1930;
  border: 1px solid #22304d;
  border-radius: 12px;
  text-align: center;
  height: 200px; width: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 6px 22px rgba(20,40,80,.10);
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease;
}
.connector-item:hover { transform: translateY(-2px); border-color: #3b5aa0; box-shadow: 0 10px 26px rgba(20,40,80,.18); }
.connector-item img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto 6px;
  background: #0e172b;
  border-radius: 6px;
}
.connector-item p { font-size: 13px; font-weight: 600; color: #9fb0d0; margin: 0; }

/* ===== Builder row ===== */
.builder-template { width: 100%; margin-top: 24px; }
.builder-template h2 { color:#fff; margin: 0 0 10px; }
.builder-row {
  display: flex; justify-content: center; align-items: stretch; gap: 16px;
  background: linear-gradient(180deg, #121a2b, #0e1728);
  border: 1px solid #22304d;
  border-radius: 14px;
  padding: 20px; min-height: 330px;
}

/* ===== Slots (3-row grid) ===== */
.builder-slot {
  flex: 1;
  min-width: 340px;
  min-height: 330px;
  border: 2px dashed #324569; border-radius: 12px;
  background: #0b1426;
  display: grid;
  grid-template-rows: 10% 1fr 10%;
  color: #9fb0d0;
  padding: 12px;
}
.builder-slot.disabled { opacity: .5; pointer-events: none; }

.slot-top, .slot-mid, .slot-bot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.connector1 .slot-mid { justify-content: flex-end; text-align: right; }
.connector2 .slot-mid { justify-content: flex-start; text-align: left; }

/* ===== Selected item visuals ===== */
.selected-item { text-align: center; }
.selected-item img {
  width: 100%;
  max-width: 160px;
  height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ===== Cable slot specifics ===== */
.builder-slot--cable .slot-top p { font-weight: 600; color: #fff; }
.builder-slot--cable .cable-visual {
  width: 100%; height: 100%;
  display: grid; place-items: center;
}
.builder-slot--cable .selected-line {
  min-height: 22px;
  color: #9fb0d0;
  opacity: .95;
}
.builder-slot--cable .slot-bot { padding-top: 6px; }
.cable-selection-nester {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
  width: 100%;
}
.cable-selection-nester select,
.cable-selection-nester input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #324569;
  background: #0f1930;
  color: #eef3ff;
}
.cable-selection-nester input[type="number"]::placeholder { color: #6f84aa; }

/* ===== Action buttons ===== */
.button-container {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
}
.button-24 {
  border-radius: 10px; border: 1px solid #1450d9;
  background: #4f7cff; color: #fff; cursor: pointer;
  font: 800 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  min-height: 40px; padding: 12px 14px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.button-24:hover { background: #3b66e3; border-color: #2f56cf; }
.button-24:active { transform: translateY(1px); }
.button-caution { background: #FF4742; border-color: #FF4742; }
.button-caution:hover { background: #ff5d59; border-color: #ff5d59; }
.button-true { background: #4f7cff; border-color: #1450d9; }
.button-true:hover { background: #3b66e3; border-color: #2f56cf; }

/* ===== Modal wrap (PHP-rendered, shown/hidden via JS) ===== */
#cablewizard-modal-wrap {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 8, 20, 0.78);
  backdrop-filter: blur(6px);
  box-sizing: border-box;
}

#cablewizard-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
}

/* ===== Modal dialog ===== */
.modal-content {
  position: relative;
  z-index: 1;
  width: min(560px, 90%);
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #324569 #0e172b;
  background: linear-gradient(180deg, #121a2b, #0e1728);
  border: 1px solid #22304d;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  color: #eef3ff;
  box-sizing: border-box;
  margin: auto;
}
.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-thumb { background: #324569; border-radius: 8px; }
.modal-content::-webkit-scrollbar-track { background: #0e172b; }

.modal-content h2 {
  margin: 0 0 16px;
  font-size: 28px;
  color: #fff;
  padding-right: 44px;
}

/* ===== Close button ===== */
.quote-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #22304d;
  background: #0f1930;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.quote-modal-close:hover {
  border-color: #3b5aa0;
  background: #15244a;
}

/* ===== Quote summary block ===== */
.quote-summary {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #22304d;
  background: #0b1426;
}
.quote-summary p {
  margin: 4px 0;
  font-size: 14px;
  color: #c5cfeb;
}
.quote-summary p strong { color: #eef3ff; }

/* ===== Success screen ===== */
.cablewizard-success-box {
  text-align: center;
  padding: 40px 20px;
}
.cablewizard-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f7cff, #62e8c6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  margin: 0 auto 20px;
}
.cablewizard-success-box h3 {
  font-size: 24px;
  color: #fff;
  margin: 0 0 10px;
}
.cablewizard-success-box p {
  color: #9fb0d0;
  margin: 0 0 24px;
}

/* ===== WPForms dark overrides ===== */
.modal-content .wpforms-container {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}
.modal-content .wpforms-form { color: #eef3ff; }
.modal-content .wpforms-field { padding-bottom: 4px; }

/* Force all WPForms columns to full width EXCEPT name field */
.modal-content .wpforms-field-container,
.modal-content .wpforms-form .wpforms-field {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  clear: both !important;
}

/* All half/third columns full width by default */
.modal-content .wpforms-form .wpforms-one-half,
.modal-content .wpforms-form .wpforms-one-third,
.modal-content .wpforms-form .wpforms-two-thirds,
.modal-content .wpforms-form .wpforms-first,
.modal-content .wpforms-form .wpforms-last {
  width: 100% !important;
  float: none !important;
  clear: both !important;
}

/* Exception: allow name field First/Last to sit side by side */
.modal-content .wpforms-form .wpforms-field-name .wpforms-one-half {
  width: calc(50% - 6px) !important;
  float: left !important;
  clear: none !important;
  box-sizing: border-box !important;
}
.modal-content .wpforms-form .wpforms-field-name .wpforms-one-half.wpforms-first {
  margin-right: 12px !important;
}

.modal-content .wpforms-render-modern .wpforms-field-row,
.modal-content .wpforms-render-modern .wpforms-field {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.modal-content .wpforms-container-full .wpforms-form {
  padding: 0 !important;
  margin: 0 !important;
}

.modal-content .wpforms-field-label,
.modal-content .wpforms-field-label-inline,
.modal-content legend.wpforms-field-label {
  color: #eef3ff !important;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal-content .wpforms-required-label { color: #62e8c6 !important; }
.modal-content .wpforms-field-sublabel { color: #9fb0d0 !important; margin-top: 4px; }

.modal-content .wpforms-form input[type="text"],
.modal-content .wpforms-form input[type="email"],
.modal-content .wpforms-form input[type="number"],
.modal-content .wpforms-form input[type="tel"],
.modal-content .wpforms-form textarea,
.modal-content .wpforms-form select {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  background: #0f1930 !important;
  border: 1px solid #324569 !important;
  border-radius: 10px !important;
  color: #eef3ff !important;
  padding: 10px 14px !important;
  box-shadow: none !important;
  font-size: 14px !important;
}
.modal-content .wpforms-form input[type="text"]::placeholder,
.modal-content .wpforms-form input[type="email"]::placeholder,
.modal-content .wpforms-form input[type="number"]::placeholder,
.modal-content .wpforms-form input[type="tel"]::placeholder,
.modal-content .wpforms-form textarea::placeholder {
  color: #6f84aa !important;
}
.modal-content .wpforms-form input[readonly],
.modal-content .wpforms-form textarea[readonly] {
  background: #0b1426 !important;
  color: #9fb0d0 !important;
  border-color: #22304d !important;
}
.modal-content .wpforms-form input:focus,
.modal-content .wpforms-form textarea:focus,
.modal-content .wpforms-form select:focus {
  outline: none !important;
  border-color: #4f7cff !important;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18) !important;
}
.modal-content .wpforms-form textarea {
  min-height: 100px !important;
  resize: vertical;
}

/* ===== Submit button styling only — let WPForms handle Turnstile layout ===== */
.modal-content .wpforms-form button[type="submit"],
.modal-content .wpforms-form .wpforms-submit {
  float: right !important;
  border-radius: 10px !important;
  border: 1px solid #1450d9 !important;
  background: #4f7cff !important;
  color: #fff !important;
  padding: 10px 24px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: background .15s ease, border-color .15s ease !important;
}
.modal-content .wpforms-form button[type="submit"]:hover,
.modal-content .wpforms-form .wpforms-submit:hover {
  background: #3b66e3 !important;
  border-color: #2f56cf !important;
}
.modal-content .wpforms-error { color: #ffb4b4 !important; }
.modal-content .wpforms-field input.wpforms-error,
.modal-content .wpforms-field textarea.wpforms-error,
.modal-content .wpforms-field select.wpforms-error {
  border-color: #ff6b6b !important;
}

/* ===== Hide pre-filled read-only builder fields ===== */
#cablewizard-modal-wrap #wpforms-1194-field_1-container,
#cablewizard-modal-wrap #wpforms-1194-field_2-container,
#cablewizard-modal-wrap #wpforms-1194-field_3-container,
#cablewizard-modal-wrap #wpforms-1194-field_4-container {
  display: none !important;
}

/* ===== Body lock when modal open ===== */
body.quote-modal-open { overflow: hidden; }

/* ===== Footer ===== */
.builder-foot {
  border-top: 1px solid #22304d;
  text-align: center; color: #9fb0d0;
  font-size: 13px; padding: 16px 20px;
}

/* ===== Helpers ===== */
.cable-warning {
  font-size: 14px;
  color: orange;
  font-style: italic;
}
.helper-text {
  margin: 8px 0 12px;
  font-size: 14px;
  color: orange;
  font-style: italic;
}

.length-input-wrap {
  display: flex;
  align-items: center;
  background: #0f1930;
  border: 1px solid #324569;
  border-radius: 10px;
  padding: 0 10px;
  color: #eef3ff;
}
.length-input-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: #eef3ff;
  width: 60px;
  padding: 10px;
}
.length-input-wrap .unit {
  font-size: 14px;
  color: #9fb0d0;
  margin-left: 4px;
}
.length-input-wrap input[type="number"] {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
  text-align: center;
  font-size: 14px;
  color: #eef3ff;
}

/* ===== Loading spinner ===== */
.connector-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 30vh;
  gap: 16px;
  color: #9fb0d0;
  font-size: 14px;
}
.connector-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #22304d;
  border-top-color: #4f7cff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  #cablewizard-modal-wrap { padding: 14px; align-items: flex-start; }
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 28px);
    padding: 20px;
    border-radius: 14px;
  }
  .modal-content h2 { font-size: 22px; }

  /* Stack name fields on mobile */
  .modal-content .wpforms-form .wpforms-field-name .wpforms-one-half {
    width: 100% !important;
    float: none !important;
    clear: both !important;
    margin-right: 0 !important;
  }
}