/* ============================================================================
   Parts Intel toolbar — shared styles (extracted verbatim from index.html so
   the toolbar renders byte-identically on every page that loads it).
   Source order matters: the BASE block below is followed by the LIGHT RE-SKIN
   block (which overrides .pi-bar/.pi-tab/.pi-input/.pi-search-btn/etc. by
   cascade) exactly as on Home. References shared CSS vars from theme.css /
   brand-vars.css / theme-light.css — does NOT redefine them.
   ============================================================================ */

/* ── BASE: Parts Intelligence search bar ── */
.pi-bar {
  background: #ffffff;
  padding: 0 24px;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.pi-bar-top {
  display: flex;
  align-items: center;
  gap: 0;
  height: 42px;
}
.pi-bar-label {
  color: var(--accent-color);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
  margin-right: 16px;
  flex-shrink: 0;
}
.pi-tabs {
  display: flex;
  height: 100%;
  gap: 2px;
}
.pi-tab {
  padding: 0 16px;
  height: 100%;
  background: transparent;
  border: none;
  color: #6b8ab8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  white-space: nowrap;
}
.pi-tab:hover { color: #fff; }
.pi-tab.active { color: var(--accent-color); border-bottom-color: var(--accent-color); }
.pi-panel {
  display: none;
  padding: 10px 0 12px;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pi-panel.active { display: flex; }
.pi-input {
  padding: 7px 12px;
  border: 1px solid #334d6e;
  border-radius: 6px;
  background: var(--primary-color);
  color: #fff;
  font-size: 13px;
  outline: none;
  width: 200px;
}
.pi-input::placeholder { color: #6b8ab8; }
.pi-input:focus { border-color: var(--accent-color); }
.pi-search-btn {
  padding: 7px 16px;
  background: var(--accent-color);
  color: var(--brand-panel);
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pi-search-btn:hover { background: #b8943b; }
.pi-hint { font-size: 11px; color: #4a6a9a; font-style: italic; }
.pi-spinner { display: none; color: var(--accent-color); font-size: 11px; }
.pi-results-wrap {
  display: none;
  background: #fff;
  border-bottom: 3px solid var(--primary-color);
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
}
.pi-results-wrap.open { display: block; }

/* ── Parts Pricing tab — re-skinned for dark theme readability ── */
#piPricingResults { display:none; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:20px 24px; margin:0 24px 16px; color:var(--text); }
#piPricingResults.open { display:block; }
.pricing-part-header { margin-bottom:16px; }
.pricing-part-header h3 { font-size:16px; color:var(--accent); margin:0 0 2px; font-family:'Rajdhani',sans-serif; letter-spacing:1px; }
.pricing-part-header p  { font-size:12px; color:var(--muted); margin:0; }
/* Hero "Best Price" card — high-contrast cyan-on-navy with gold Buy button */
.best-price-card {
  display:flex; align-items:center; gap:16px;
  background:linear-gradient(135deg, var(--surface2), var(--bg));
  color:var(--text); border-radius:8px; padding:14px 18px; margin-bottom:16px;
  border:1px solid rgba(0,212,255,0.30);
}
.best-price-card .bp-label  { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); }
.best-price-card .bp-price  { font-size:28px; font-weight:900; color:var(--accent); line-height:1.1; font-family:'Rajdhani',sans-serif; }
.best-price-card .bp-meta   { font-size:12px; color:var(--muted); margin-top:2px; }
.best-price-card .bp-buy {
  margin-left:auto; padding:8px 18px; border-radius:6px; font-weight:700;
  font-size:13px; font-family:'Rajdhani',sans-serif; letter-spacing:1px;
  cursor:pointer; text-decoration:none; white-space:nowrap;
  background:rgba(0,212,255,0.15); color:var(--accent); border:1px solid rgba(0,212,255,0.40);
  transition:background .15s;
}
.best-price-card .bp-buy:hover { background:rgba(0,212,255,0.30); }
/* Distributor pricing table — match hero card readability */
.pricing-table { width:100%; border-collapse:collapse; font-size:12px; }
.pricing-table th {
  background:var(--surface2); color:var(--muted); padding:9px 12px;
  text-align:left; font-weight:600; font-size:10px;
  text-transform:uppercase; letter-spacing:1px;
  border-bottom:1px solid var(--border);
}
.pricing-table td {
  padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.06);
  vertical-align:middle; color:var(--text);
}
.pricing-table tbody tr:hover td { background:rgba(0,212,255,0.04); }
.pricing-table tr:last-child td { border-bottom:none; }
/* Distributor name: full white, primary data weight */
.pricing-table td:first-child { font-weight:600; color:var(--text); font-size:13px; }
/* Stock + Price: bright, primary data */
.pricing-table .in-stock  { color:var(--accent2); font-weight:700; font-size:13px; }
.pricing-table .no-stock  { color:var(--muted); font-style:italic; }
.pricing-table td[data-price] { color:var(--accent); font-weight:800; font-size:14px; font-family:'Rajdhani',sans-serif; }
/* Lead time: secondary but still readable */
.pricing-table td[data-lead] { color:var(--muted); font-size:11px; }
/* Per-row Buy button: cyan-on-navy, smaller version of hero card button */
.pricing-buy-btn {
  font-size:11px; padding:5px 12px; border-radius:4px;
  background:rgba(0,212,255,0.10); color:var(--accent);
  border:1px solid rgba(0,212,255,0.30);
  font-family:'Rajdhani',sans-serif; font-weight:700; letter-spacing:.5px;
  cursor:pointer; text-decoration:none; white-space:nowrap;
  transition:background .15s;
}
.pricing-buy-btn:hover { background:rgba(0,212,255,0.25); }
.pricing-not-found { text-align:center; padding:32px; color:var(--muted); font-size:14px; }
.pricing-not-found .nf-icon { font-size:36px; margin-bottom:8px; opacity:.5; }

/* ── CAGE popup modal ── */
.cage-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cage-overlay.open { display: flex; }
.cage-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: hidden;
}
.cage-modal-header {
  background: var(--primary-color);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cage-modal-header h3 { font-size: 14px; margin: 0; }
.cage-modal-body { padding: 18px; }
.cage-field { margin-bottom: 10px; }
.cage-field-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #9ca3af; font-weight: 700; }
.cage-field-val   { font-size: 14px; font-weight: 600; color: #1f2937; margin-top: 2px; }
.cage-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f0f2f5; }
.cage-link-btn {
  padding: 5px 12px; border-radius: 20px; font-size: 12px;
  font-weight: 600; text-decoration: none; border: 1px solid;
  display: inline-block; cursor: pointer;
}
.cage-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; margin-left: 8px;
}

/* ── ILS tabs (results panel) ── */
.ils-tabs {
  display: flex;
  border-bottom: 2px solid var(--primary-color);
  margin-bottom: 0;
  flex-wrap: wrap;
}
.ils-tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  border: none;
  background: #e2e8f0;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.ils-tab.active {
  background: #fff;
  color: var(--primary-color);
  border-color: var(--primary-color);
}
.ils-tab:hover:not(.active) { background: #f0f4ff; color: var(--primary-color); }
.ils-tab-content { display: none; padding: 14px 0 0; }
.ils-tab-content.active { display: block; }

/* ── Supplier cards (results panel) ── */
.supplier-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.supplier-card:hover { border-color: var(--primary-color); box-shadow: 0 2px 8px rgba(26,60,110,.08); }
.sc-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sc-icon.oem  { background: #eff6ff; }
.sc-icon.dist { background: #f0fdf4; }
.sc-icon.surp { background: #fefce8; }
.sc-body { flex: 1; min-width: 0; }
.sc-name { font-size: 13px; font-weight: 700; color: var(--primary-color); }
.sc-meta { font-size: 11px; color: #6b7280; margin-top: 2px; }
.sc-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.sc-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.sc-badge.green  { background: #dcfce7; color: #166534; }
.sc-badge.yellow { background: #fef9c3; color: #854d0e; }
.sc-badge.gray   { background: #f3f4f6; color: #374151; }
.sc-badge.blue   { background: #dbeafe; color: #1d4ed8; }

/* ── Link grid (results panel) ── */
.link-group { margin-bottom: 16px; }
.link-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #6b7280; margin-bottom: 8px;
  padding-bottom: 4px; border-bottom: 1px solid #f0f2f5;
}
.link-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.lnk {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid;
  transition: all .12s;
}
.lnk.navy  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.lnk.navy:hover  { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.lnk.green { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.lnk.green:hover { background: #059669; color: #fff; border-color: #059669; }
.lnk.gold  { background: #fefce8; color: #854d0e; border-color: #fde68a; }
.lnk.gold:hover  { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }
.lnk.gray  { background: #f9fafb; color: #374151; border-color: #d1d5db; }
.lnk.gray:hover  { background: #374151; color: #fff; border-color: #374151; }

/* ── AI box (results panel) ── */
.parts-ai-box {
  background: #fff;
  border: 1px solid #d1fae5;
  border-left: 4px solid #059669;
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}
.parts-ai-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #059669; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}

/* ── LIGHT RE-SKIN (overrides base by source order, exactly as on Home) ── */
.pi-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
}
.pi-bar-label { color: var(--accent); font-family: 'Rajdhani', sans-serif; letter-spacing: 1px; }
.pi-tab {
  background: var(--surface2); color: var(--muted);
  border: 1px solid var(--border);
}
.pi-tab:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.pi-tab.active {
  background: rgba(0,212,255,0.10); color: var(--accent);
  border-color: rgba(0,212,255,0.30);
}
.pi-input {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
}
.pi-input::placeholder { color: var(--muted); }
.pi-input:focus { border-color: rgba(0,212,255,0.40); outline: none; }
.pi-search-btn {
  background: rgba(0,212,255,0.10); color: var(--accent);
  border: 1px solid rgba(0,212,255,0.30);
}
.pi-search-btn:hover { background: rgba(0,212,255,0.20); }
.pi-hint { color: var(--muted); }
.pi-spinner { color: var(--accent); }
.pi-results-wrap, #piPricingResults {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
}
.pi-results-wrap *, #piPricingResults * { color: inherit; }
