/* Scoped Frontend Styles for Threaded Rod Configurator */

.cfg-barre-root {
  --cfg-bg: var(--cfg-primary, #e65100);
  --cfg-bg-dark: #b83d00;
  --cfg-text-white: #ffffff;
  --cfg-green: #10b981;
  --cfg-green-bg: rgba(16, 185, 129, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  margin: 15px auto;
  max-width: 1140px;
  width: 100%;
  line-height: 1.45;
}

.cfg-barre-root *, .cfg-barre-root *::before, .cfg-barre-root *::after {
  box-sizing: inherit;
}

/* Container */
.cfg-container {
  background: var(--cfg-bg);
  color: var(--cfg-text-white);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Header */
.cfg-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cfg-badge-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.cfg-main-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: break-word;
}

@media (min-width: 640px) {
  .cfg-header {
    padding: 20px 28px;
  }
  .cfg-main-title {
    font-size: 24px;
  }
}

.cfg-stock-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.cfg-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: cfgPulse 2s infinite;
}

@keyframes cfgPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Grid Layout */
.cfg-grid {
  display: grid;
  grid-template-columns: 100%;
  gap: 20px;
  padding: 16px 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 900px) {
  .cfg-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 28px;
  }
}

/* Columns */
.cfg-col-left, .cfg-col-right {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Left Column: Blueprint Card */
.cfg-blueprint-card {
  background: #ffffff;
  color: #1e293b;
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .cfg-blueprint-card {
    padding: 20px;
  }
}

.cfg-svg-wrap {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .cfg-svg-wrap {
    padding: 12px;
    margin-bottom: 18px;
  }
}

.cfg-schema-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.cfg-table-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cfg-table-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 8px 0;
  letter-spacing: 0.04em;
}

.cfg-tables-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 14px;
}

.cfg-spec-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  text-align: center;
  table-layout: fixed;
  margin-bottom: 6px;
}

@media (min-width: 420px) {
  .cfg-spec-table {
    font-size: 11px;
  }
}

.cfg-spec-table td {
  border: 1px solid #cbd5e1;
  padding: 3px 1px;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .cfg-spec-table td {
    padding: 4px 2px;
  }
}

.cfg-spec-table .cfg-tr-header {
  background: #f1f5f9;
  font-weight: 700;
  color: #0f172a;
}

.cfg-spec-table .cfg-label-cell {
  background: var(--cfg-bg);
  color: #ffffff;
  font-weight: 800;
  width: 22px;
}

.cfg-legend-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 14px;
  font-size: 11px;
  color: #431407;
  min-width: 0;
}

.cfg-legend-title {
  font-weight: 800;
  color: #7c2d12;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cfg-legend-box ul {
  margin: 0;
  padding-left: 4px;
  list-style: none;
}

.cfg-legend-box li {
  margin-bottom: 2px;
  color: #713f12;
}

.cfg-legend-box li strong {
  color: #1e293b;
}

/* Basket / Summary Card */
.cfg-summary-card {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.cfg-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cfg-summary-header h4 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
}

.cfg-ready-tag {
  font-size: 10px;
  color: #ffedd5;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.cfg-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.cfg-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  min-width: 0;
}

.cfg-summary-item-title {
  font-weight: 700;
  color: #fed7aa;
  word-break: break-word;
}

.cfg-summary-item-sub {
  font-size: 10.5px;
  color: #e2e8f0;
}

.cfg-item-remove-btn {
  background: none;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  flex-shrink: 0;
}
.cfg-item-remove-btn:hover {
  color: #ffffff;
}

/* Right Column: Form Controls */
.cfg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 640px) {
  .cfg-form {
    gap: 18px;
  }
}

.cfg-field-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.cfg-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cfg-req {
  color: #fca5a5;
}

.cfg-hint {
  font-size: 11px;
  color: #ffedd5;
  margin: 0 0 5px 0;
}

.cfg-radio-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cfg-radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  user-select: none;
}

.cfg-radio-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ffffff;
  flex-shrink: 0;
}

.cfg-select-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.cfg-select {
  width: 100%;
  padding: 11px 14px;
  background: #ffffff;
  color: #1e293b;
  border-radius: 8px;
  border: 1px solid #fed7aa;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cfg-input-unit-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.cfg-input {
  width: 100%;
  padding: 11px 14px;
  background: #ffffff;
  color: #1e293b;
  border-radius: 8px;
  border: 1px solid #fed7aa;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cfg-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.cfg-input:focus, .cfg-select:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.cfg-input.cfg-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4) !important;
}

.cfg-input-error-msg {
  background: rgba(153, 27, 27, 0.9);
  color: #fee2e2;
  border: 1px solid #fca5a5;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: cfgFadeIn 0.25s ease;
  word-break: break-word;
}

.cfg-unit {
  position: absolute;
  right: 14px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

/* Green Availability Badge (<= 100) */
.cfg-availability-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #059669;
  border: 1px solid #34d399;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
  animation: cfgFadeIn 0.3s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.cfg-badge-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  color: #059669;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.cfg-badge-text {
  flex: 1 1 0%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.cfg-badge-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  word-break: break-word;
}

.cfg-badge-sub {
  font-size: 11px;
  color: #d1fae5;
  line-height: 1.4;
  margin-top: 2px;
  word-break: break-word;
}

/* Large Quantity Dedicated Quote Badge (> 100) */
.cfg-large-quantity-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fbbf24;
  color: #1e293b;
  border: 2px solid #f59e0b;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
  animation: cfgFadeIn 0.3s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.cfg-badge-icon-yellow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f172a;
  color: #fbbf24;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.cfg-badge-title-yellow {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}

.cfg-badge-sub-yellow {
  font-size: 11.5px;
  font-weight: 600;
  color: #451a03;
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

/* Action Controls */
.cfg-action-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
  animation: cfgFadeIn 0.3s ease;
  width: 100%;
  min-width: 0;
}

.cfg-add-another-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  min-width: 0;
  width: 100%;
}

.cfg-add-another-text {
  flex: 1 1 0%;
  min-width: 0;
}

.cfg-add-another-text strong {
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  display: block;
}

.cfg-add-another-text p {
  margin: 3px 0 0 0;
  font-size: 11px;
  color: #fed7aa;
  line-height: 1.4;
}

.cfg-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ffffff;
  margin-top: 1px;
  flex-shrink: 0;
}

.cfg-btn-primary {
  width: 100%;
  background: #ffffff;
  color: var(--cfg-bg);
  font-size: 14.5px;
  font-weight: 800;
  padding: 13px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, background 0.2s;
  box-sizing: border-box;
}

.cfg-btn-primary:hover {
  background: #fff7ed;
  transform: translateY(-1px);
}

.cfg-btn-primary:active {
  transform: translateY(0);
}

.cfg-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Modal Window */
.cfg-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}

.cfg-modal-card {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 620px;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
  animation: cfgScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .cfg-modal-overlay {
    padding: 20px;
  }
  .cfg-modal-card {
    padding: 28px;
  }
}

@keyframes cfgScaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes cfgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cfg-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.cfg-modal-tag {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cfg-bg);
  letter-spacing: 0.05em;
}

.cfg-modal-title {
  margin: 2px 0 0 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

@media (min-width: 640px) {
  .cfg-modal-title {
    font-size: 20px;
  }
}

.cfg-modal-sub {
  margin: 3px 0 0 0;
  font-size: 11.5px;
  color: #64748b;
}

.cfg-modal-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
}

.cfg-modal-close:hover {
  color: #0f172a;
}

.cfg-modal-recap {
  background: #fff7ed;
  border: 1px solid #ffedd5;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0;
  font-size: 11.5px;
}

.cfg-recap-title {
  font-weight: 800;
  color: #7c2d12;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cfg-green-dot {
  color: #059669;
  font-weight: 900;
}

.cfg-recap-list {
  margin: 0;
  padding-left: 16px;
  color: #334155;
}

.cfg-recap-list li {
  margin-bottom: 3px;
}

/* Contact Form Inside Modal */
.cfg-lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfg-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 500px) {
  .cfg-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.cfg-form-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cfg-lead-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 3px;
}

.cfg-lead-input, .cfg-lead-textarea {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  box-sizing: border-box;
}

.cfg-lead-input:focus, .cfg-lead-textarea:focus {
  background: #ffffff;
  border-color: var(--cfg-bg);
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.cfg-uppercase {
  text-transform: uppercase;
}

.cfg-privacy-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.cfg-privacy-row label {
  cursor: pointer;
  user-select: none;
}

.cfg-form-feedback {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.cfg-form-feedback.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cfg-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.cfg-btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border: none;
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.cfg-btn-cancel:hover {
  background: #e2e8f0;
}

.cfg-btn-submit {
  background: var(--cfg-bg);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.3);
  transition: opacity 0.2s;
}

.cfg-btn-submit:hover {
  opacity: 0.92;
}

.cfg-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Success View */
.cfg-success-view {
  text-align: center;
  padding: 20px 8px;
}

.cfg-success-check {
  width: 50px;
  height: 50px;
  background: #d1fae5;
  color: #059669;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

.cfg-success-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.cfg-success-desc {
  font-size: 13px;
  color: #64748b;
  max-width: 440px;
  margin: 0 auto 18px auto;
  line-height: 1.5;
}

.cfg-btn-reset {
  background: #0f172a;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 20px;
  border-radius: 8px;
  cursor: pointer;
}

.cfg-btn-reset:hover {
  background: #334155;
}
