/*
 * NFH FBA Prep Cost Estimator — nfh-fba-prep-cost-estimator.css
 * Version:  1.0.0
 * Author:   National Freight Hub
 *
 * All styles are scoped to #nfh-fba-app to prevent any bleed
 * into the WordPress theme or other page elements.
 */

/* ============================================================
   SCOPED PLUGIN CSS — #nfh-fba-app
   ============================================================ */
#nfh-fba-app {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #111;
  font-size: 15px;
  box-sizing: border-box;
}
#nfh-fba-app *, #nfh-fba-app *::before, #nfh-fba-app *::after {
  box-sizing: border-box;
}

/* Header */
.nfh-fba-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #071626;
}
.nfh-fba-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: #071626;
  margin: 0 0 6px;
}
.nfh-fba-header p {
  font-size: 15px;
  color: #666;
  margin: 0;
  line-height: 1.6;
}

/* Step indicators */
.nfh-fba-steps {
  display: flex;
  gap: 0;
  margin-bottom: 1.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}
.nfh-fba-step {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  background: #f8f9fa;
  cursor: pointer;
  border-right: 1px solid #e0e0e0;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}
.nfh-fba-step:last-child { border-right: none; }
.nfh-fba-step.active {
  background: #071626;
  color: #fff;
}
.nfh-fba-step.done {
  background: #e8f0f8;
  color: #071626;
}
.nfh-fba-step-num {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 2px;
}
.nfh-fba-step.active .nfh-fba-step-num { opacity: 0.6; color: #fff; }
.nfh-fba-step.done .nfh-fba-step-num { color: #C98221; opacity: 1; }

/* Panel */
.nfh-fba-panel { display: none; }
.nfh-fba-panel.active { display: block; }

/* Card */
.nfh-fba-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.35rem;
  margin-bottom: 1rem;
}
.nfh-fba-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: #071626;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1rem;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

/* Grid layouts */
.nfh-fba-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.nfh-fba-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .nfh-fba-grid-2 { grid-template-columns: 1fr; }
  .nfh-fba-grid-3 { grid-template-columns: 1fr 1fr; }
  .nfh-fba-steps { flex-wrap: wrap; }
  .nfh-fba-step { flex: 1 1 50%; border-right: none; border-bottom: 1px solid #e0e0e0; }
  .nfh-fba-result-summary { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 420px) {
  .nfh-fba-grid-3 { grid-template-columns: 1fr; }
}

/* Field */
.nfh-fba-field { margin-bottom: 1rem; }
.nfh-fba-field:last-child { margin-bottom: 0; }
.nfh-fba-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 5px;
}
.nfh-fba-help {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  line-height: 1.4;
}
.nfh-fba-optional {
  font-size: 11px;
  font-weight: 400;
  color: #bbb;
  margin-left: 4px;
}

/* Input wrapper */
.nfh-fba-iw {
  display: flex;
  align-items: stretch;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
}
.nfh-fba-iw:focus-within {
  border-color: #071626;
  box-shadow: 0 0 0 3px rgba(7,22,38,0.07);
}
.nfh-fba-iw input, .nfh-fba-iw select {
  flex: 1;
  border: none;
  padding: 10px 13px;
  font-size: 15px;
  outline: none;
  color: #111;
  background: transparent;
  min-width: 0;
  font-family: inherit;
}
.nfh-fba-iw input::placeholder { color: #bbb; }
.nfh-fba-iw select { cursor: pointer; }
.nfh-fba-u {
  padding: 10px 11px;
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  color: #888;
  display: flex;
  align-items: center;
  border-left: 1px solid #eee;
  white-space: nowrap;
}
.nfh-fba-upre {
  padding: 10px 11px;
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  color: #888;
  display: flex;
  align-items: center;
  border-right: 1px solid #eee;
}

/* Select-only wrapper */
.nfh-fba-select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: inherit;
  color: #111;
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.nfh-fba-select:focus {
  border-color: #071626;
  box-shadow: 0 0 0 3px rgba(7,22,38,0.07);
}

/* Services section (Step 2) */
.nfh-fba-service-group {
  margin-bottom: 1.25rem;
}
.nfh-fba-service-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
  margin-bottom: 8px;
}
.nfh-fba-service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 5px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.nfh-fba-service-row:hover { border-color: #ccc; }
.nfh-fba-service-row.selected {
  border-color: #071626;
  background: #f0f4f8;
}
.nfh-fba-service-cb {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: #071626;
  cursor: pointer;
}
.nfh-fba-service-info {
  flex: 1;
  min-width: 0;
}
.nfh-fba-service-name {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}
.nfh-fba-service-basis {
  font-size: 11px;
  color: #999;
  margin-top: 1px;
}
.nfh-fba-rate-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
  width: 120px;
}
.nfh-fba-service-row.selected .nfh-fba-rate-wrap { border-color: #aab8c6; }
.nfh-fba-rate-sign {
  padding: 7px 8px;
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  color: #888;
  border-right: 1px solid #eee;
}
.nfh-fba-rate-input {
  width: 65px;
  border: none;
  padding: 7px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  background: transparent;
  outline: none;
  font-family: inherit;
}
.nfh-fba-rate-basis {
  font-size: 10px;
  color: #bbb;
  padding: 0 6px;
  white-space: nowrap;
}

/* Toggle for service select all */
.nfh-fba-service-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.nfh-fba-sctrl-btn {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.nfh-fba-sctrl-btn:hover { background: #ebebeb; }

/* Navigation buttons */
.nfh-fba-nav {
  display: flex;
  gap: 10px;
  margin-top: 1.5rem;
  align-items: center;
}
.nfh-fba-btn-next {
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #071626;
  color: #fff;
  transition: background 0.15s;
}
.nfh-fba-btn-next:hover { background: #0d2640; }
.nfh-fba-btn-back {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  color: #555;
  transition: background 0.15s;
}
.nfh-fba-btn-back:hover { background: #f5f5f5; }
.nfh-fba-btn-calc {
  padding: 13px 32px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #C98221;
  color: #fff;
  transition: background 0.15s;
}
.nfh-fba-btn-calc:hover { background: #a86b18; }

/* Validation error */
.nfh-fba-error {
  display: none;
  background: #fef0f0;
  border: 1px solid #f5c6c6;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 13px;
  color: #c0392b;
  margin-top: 12px;
}
.nfh-fba-error.show { display: block; }

/* Results */
.nfh-fba-result { display: none; }
.nfh-fba-result.show { display: block; }

.nfh-fba-result-title {
  font-size: 20px;
  font-weight: 700;
  color: #071626;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #071626;
}

.nfh-fba-result-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 700px) {
  .nfh-fba-result-summary { grid-template-columns: 1fr 1fr; }
}
.nfh-fba-stat {
  background: #f8f9fa;
  border-radius: 9px;
  padding: 14px 14px 12px;
  text-align: center;
}
.nfh-fba-stat-val {
  font-size: 24px;
  font-weight: 800;
  color: #071626;
  line-height: 1;
  margin-bottom: 5px;
}
.nfh-fba-stat-lbl {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nfh-fba-stat.highlight {
  background: #071626;
}
.nfh-fba-stat.highlight .nfh-fba-stat-val { color: #fff; }
.nfh-fba-stat.highlight .nfh-fba-stat-lbl { color: rgba(255,255,255,0.6); }
.nfh-fba-stat.accent {
  background: #fdf3e3;
}
.nfh-fba-stat.accent .nfh-fba-stat-val { color: #C98221; }

/* Complexity badge */
.nfh-fba-complexity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}
.nfh-fba-complexity.simple { background: #e8f5e9; color: #2e7d32; }
.nfh-fba-complexity.moderate { background: #fff8e1; color: #f57f17; }
.nfh-fba-complexity.complex { background: #fff3e0; color: #e65100; }
.nfh-fba-complexity.high-touch { background: #fce4ec; color: #880e4f; }

/* Breakdown table */
.nfh-fba-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 14px;
}
.nfh-fba-breakdown thead tr {
  background: #f0f4f8;
}
.nfh-fba-breakdown th {
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  border-bottom: 2px solid #ddd;
}
.nfh-fba-breakdown td {
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  vertical-align: middle;
}
.nfh-fba-breakdown tr:last-child td { border-bottom: none; }
.nfh-fba-breakdown tr:hover td { background: #f8f9fa; }
.nfh-fba-breakdown .total-row td {
  font-weight: 700;
  color: #071626;
  border-top: 2px solid #ddd;
  background: #f0f4f8;
}
.nfh-fba-bar-cell { width: 80px; }
.nfh-fba-mini-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
}
.nfh-fba-mini-fill {
  height: 100%;
  border-radius: 3px;
  background: #C98221;
}
.nfh-fba-pct-text { font-size: 11px; color: #888; }

/* Smart notes / tips */
.nfh-fba-tips {
  background: #f0f4f8;
  border: 1px solid #d0dae5;
  border-radius: 9px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 14px;
}
.nfh-fba-tips-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #071626;
  margin-bottom: 10px;
}
.nfh-fba-tip-item {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 7px;
}
.nfh-fba-tip-item:last-child { margin-bottom: 0; }
.nfh-fba-tip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C98221;
  margin-top: 6px;
  flex-shrink: 0;
}

/* CTA section in results */
.nfh-fba-result-cta {
  background: #071626;
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 14px;
}
.nfh-fba-result-cta h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}
.nfh-fba-result-cta p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin: 0 0 14px;
  line-height: 1.6;
}
.nfh-fba-cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nfh-fba-cta-link {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.15s;
}
.nfh-fba-cta-link.primary {
  background: #C98221;
  color: #fff;
  border: 2px solid #C98221;
}
.nfh-fba-cta-link.primary:hover { background: #a86b18; }
.nfh-fba-cta-link.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.nfh-fba-cta-link.ghost:hover { background: rgba(255,255,255,0.08); }

/* Copy summary */
.nfh-fba-summary-box {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 9px;
  padding: 1.1rem 1.25rem;
  font-size: 13px;
  color: #444;
  line-height: 1.7;
  margin-bottom: 14px;
}
.nfh-fba-summary-box strong { color: #071626; }

/* Action buttons */
.nfh-fba-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.nfh-fba-abtn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #fff;
  color: #555;
  transition: background 0.15s;
}
.nfh-fba-abtn:hover { background: #f5f5f5; }
.nfh-fba-abtn.primary {
  background: #C98221;
  color: #fff;
  border-color: #C98221;
}
.nfh-fba-abtn.primary:hover { background: #a86b18; }

/* Disclaimer */
.nfh-fba-disclaimer {
  font-size: 12px;
  color: #999;
  line-height: 1.6;
  border-top: 1px solid #eee;
  padding-top: 14px;
  margin-top: 14px;
}

/* ============================================================
   PRINT STYLES — window.print() / Save as PDF
   Strips all interactive chrome; outputs clean result summary
   ============================================================ */
@media print {
  body {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .preview-wrap {
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    max-width: 100% !important;
  }
  /* Hide all non-result UI */
  .preview-label,
  .nfh-fba-header p,
  .nfh-fba-steps,
  .nfh-fba-nav,
  .nfh-fba-error,
  .nfh-fba-actions,
  .nfh-fba-result-cta,
  .nfh-fba-toast,
  #nfhFbaPresetBanner {
    display: none !important;
  }
  /* Hide all step panels except the results panel */
  .nfh-fba-panel {
    display: none !important;
  }
  #nfhFbaPanel4 {
    display: block !important;
  }
  /* Clean up app padding */
  #nfh-fba-app {
    padding: 0 !important;
    max-width: 100% !important;
  }
  /* Strip card chrome for a document feel */
  .nfh-fba-card {
    border: none !important;
    border-radius: 0 !important;
    padding: 0 0 1rem 0 !important;
    margin-bottom: 0.5rem !important;
  }
  .nfh-fba-card h3 {
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 4px !important;
    margin-bottom: 8px !important;
  }
  /* Keep result stat cards readable */
  .nfh-fba-stat {
    border: 1px solid #ddd !important;
  }
  .nfh-fba-stat.highlight {
    background: #071626 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nfh-fba-stat.accent {
    background: #fdf3e3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Ensure table prints with borders */
  .nfh-fba-breakdown th,
  .nfh-fba-breakdown td {
    border-bottom: 1px solid #ddd !important;
  }
  .nfh-fba-breakdown thead tr {
    background: #f0f4f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Tips and summary box */
  .nfh-fba-tips {
    background: #f0f4f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Keep mini bars visible */
  .nfh-fba-mini-fill {
    background: #C98221 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Avoid page breaks inside key sections */
  .nfh-fba-result-summary,
  .nfh-fba-breakdown,
  .nfh-fba-tips,
  .nfh-fba-summary-box {
    page-break-inside: avoid;
  }
  /* Print header — show title only */
  .nfh-fba-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.5rem !important;
  }
  .nfh-fba-result-title {
    font-size: 16px !important;
  }
  /* Disclaimer always prints */
  .nfh-fba-disclaimer {
    font-size: 10px !important;
    page-break-inside: avoid;
  }
}

/* Toast */
.nfh-fba-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #071626;
  color: #fff;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 99999;
}
.nfh-fba-toast.show { opacity: 1; }

/* Progress dots */
.nfh-fba-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #999;
  margin-left: auto;
}
.nfh-fba-prog-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
}
.nfh-fba-prog-dot.on { background: #C98221; }