/* ─────────────────────────────────────────────────────────
   TWDH Quote Builder — Frontend CSS
   ───────────────────────────────────────────────────────── */

/* Container */
.twdh-qb-wrap {
  max-width: 100%;
  margin: 0 auto 40px;
  font-family: inherit;
  color: inherit;
  box-sizing: border-box;
}

.twdh-qb-wrap *,
.twdh-qb-wrap *::before,
.twdh-qb-wrap *::after {
  box-sizing: inherit;
}

/* ── Two-column layout ── */
.twdh-qb-layout {
  display: grid;
  grid-template-columns: 70% 30%;
  gap: 28px;
  align-items: start;
}

.twdh-qb-col-services {
  min-width: 0;
}

.twdh-qb-col-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Category Tabs ── */
.twdh-qb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 768px) {
  .twdh-qb-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .twdh-qb-tabs::-webkit-scrollbar {
    display: none;
  }

  .twdh-qb-tab {
    flex-shrink: 0;
  }
}

.twdh-qb-tab {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.twdh-qb-tab:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #1e3a8a;
}

.twdh-qb-tab.is-active {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
}

/* ── Service Grid ── */
.twdh-qb-services {
  display: grid;
  gap: 16px;
  margin-bottom: 32px;
}

.twdh-qb-cols-1 { grid-template-columns: 1fr; }
.twdh-qb-cols-2 { grid-template-columns: repeat(2, 1fr); }
.twdh-qb-cols-3 { grid-template-columns: repeat(3, 1fr); }
.twdh-qb-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Service Card ── */
.twdh-qb-service-card {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  background: #fff;
}

.twdh-qb-service-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.08);
}

/* Selected state */
.twdh-qb-service-card.is-selected {
  border-color: #1e3a8a;
  background: #eff6ff;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.12);
}

.twdh-qb-card-label {
  display: block;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-weight: normal;
}

/* Hide native checkbox visually */
.twdh-qb-card-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.twdh-qb-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

/* Custom checkbox circle */
.twdh-qb-check-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  transition: all 0.15s ease;
  position: relative;
  margin-top: 2px;
}

.is-selected .twdh-qb-check-icon {
  border-color: #1e3a8a;
  background: #1e3a8a;
}

.is-selected .twdh-qb-check-icon::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 5px;
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.twdh-qb-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twdh-qb-service-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  color: #111827;
}

.twdh-qb-service-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.twdh-qb-service-desc p {
  margin: 0;
}

.twdh-qb-service-price {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  margin-top: 4px;
}

/* ── Quantity stepper ── */
.twdh-qb-qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 12px;
  border-top: 1px solid #e5e7eb;
  background: #eff6ff;
}

.twdh-qb-qty-label {
  font-size: 11px;
  font-weight: 700;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.twdh-qb-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.twdh-qb-qty-btn:hover {
  border-color: #1e3a8a;
  background: #1e3a8a;
  color: #fff;
}

.twdh-qb-qty-input {
  width: 44px;
  height: 28px;
  text-align: center;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  padding: 0 4px;
  -moz-appearance: textfield;
}

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

.twdh-qb-sel-qty {
  font-size: 11px;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Upgrade notice ── */
.twdh-qb-upgrade-note {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 24px;
}

.twdh-qb-upgrade-note a {
  color: #1e3a8a;
  font-weight: 600;
  text-decoration: none;
}

.twdh-qb-upgrade-note a:hover {
  text-decoration: underline;
}

/* ── Grouped All-tab view ── */
.twdh-qb-cat-section {
  margin-bottom: 32px;
}

.twdh-qb-cat-section:last-child {
  margin-bottom: 0;
}

.twdh-qb-cat-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.twdh-qb-cat-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  padding: 0;
}

.twdh-qb-see-all-btn {
  font-size: 12px;
  font-weight: 600;
  color: #1e3a8a;
  background: none;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.twdh-qb-see-all-btn:hover {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
}

/* Proxy cards: pointer cursor on whole card, no double-interaction on checkbox */
.twdh-qb-proxy-card {
  cursor: pointer;
}

.twdh-qb-proxy-card .twdh-qb-service-check {
  pointer-events: none;
}

/* ── Quote Summary ── */
.twdh-qb-summary {
  background: #f0f4ff;
  border: 1px solid #c7d7ff;
  border-radius: 8px;
  padding: 18px 20px;
}

.twdh-qb-summary-empty {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  margin: 0;
  text-align: center;
  padding: 8px 0;
}

.twdh-qb-summary-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e3a8a;
  margin: 0 0 10px;
}

.twdh-qb-selected-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.twdh-qb-selected-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 1px solid #dbeafe;
  color: #374151;
}

.twdh-qb-selected-list li:last-child {
  border-bottom: none;
}

.twdh-qb-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 2px solid #bfdbfe;
  font-weight: 700;
}

.twdh-qb-total-label {
  font-size: 14px;
  color: #374151;
}

.twdh-qb-total-amount {
  font-size: 18px;
  color: #1e3a8a;
}

/* ── Contact Form ── */
.twdh-qb-form-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
}

.twdh-qb-form-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 20px;
}

.twdh-qb-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 20px;
}

.twdh-qb-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.twdh-qb-field-full {
  grid-column: 1 / -1;
}

.twdh-qb-field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.twdh-qb-req {
  color: #dc2626;
}

.twdh-qb-field input,
.twdh-qb-field textarea {
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.twdh-qb-field input:focus,
.twdh-qb-field textarea:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
  outline: none;
}

.twdh-qb-field input.has-error,
.twdh-qb-field textarea.has-error {
  border-color: #dc2626;
}

.twdh-qb-field textarea {
  resize: vertical;
  min-height: 90px;
}

/* Submit row */
.twdh-qb-form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.twdh-qb-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1e3a8a;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.twdh-qb-submit-btn:hover {
  background: #1e40af;
}

.twdh-qb-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Error message */
.twdh-qb-error-msg {
  font-size: 13px;
  color: #dc2626;
  font-weight: 600;
  margin: 0;
}

/* ── Success State ── */
.twdh-qb-success {
  text-align: center;
  padding: 32px 24px;
}

.twdh-qb-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #1e3a8a;
  color: #fff;
  font-size: 26px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.twdh-qb-success h3 {
  font-size: 20px;
  color: #111827;
  margin: 0 0 8px;
}

.twdh-qb-success p {
  color: #6b7280;
  font-size: 15px;
  margin: 0 0 20px;
}

/* PDF download button */
.twdh-qb-pdf-btn {
  display: inline-block;
  background: transparent;
  color: #1e3a8a;
  border: 2px solid #1e3a8a;
  border-radius: 5px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.twdh-qb-pdf-btn:hover {
  background: #1e3a8a;
  color: #fff;
}

/* ── No-services fallback ── */
.twdh-qb-no-services {
  color: #6b7280;
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .twdh-qb-layout {
    grid-template-columns: 1fr;
  }

  .twdh-qb-col-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .twdh-qb-cols-2,
  .twdh-qb-cols-3,
  .twdh-qb-cols-4 {
    grid-template-columns: 1fr;
  }

  .twdh-qb-fields {
    grid-template-columns: 1fr;
  }

  .twdh-qb-field-full {
    grid-column: 1;
  }

  /* Qty row tighter on small screens */
  .twdh-qb-qty-row {
    gap: 6px;
  }

  .twdh-qb-qty-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .twdh-qb-qty-input {
    width: 40px;
    font-size: 14px;
  }

  /* Cat section header: wrap on very small screens */
  .twdh-qb-cat-section-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Form section padding */
  .twdh-qb-form-section {
    padding: 16px;
  }

  /* Summary padding */
  .twdh-qb-summary {
    padding: 14px 16px;
  }
}
