:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-soft: #e0f2fe;
  --accent: #0ea5e9;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Top Status Bar */
.topbar {
  background: var(--navy);
  color: #e2e8f0;
  font-size: 12.5px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.offline-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: #cbd5e1;
}

.topbar-stats strong {
  color: #ffffff;
  font-family: var(--font-mono);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-compact {
  background: var(--navy-light);
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

/* Header & Search Hero */
.hero-header {
  background: linear-gradient(135deg, #0f172a 0%, #172554 60%, #0c4a6e 100%);
  color: #ffffff;
  padding: 22px 24px 18px;
  box-shadow: var(--shadow-md);
}

.hero-inner {
  max-width: 1480px;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.logo-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 12px;
  color: #94a3b8;
}

.rfq-trigger-btn {
  background: #0284c7;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.rfq-trigger-btn:hover {
  background: #0369a1;
}

.rfq-badge {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
}

.search-bar-wrap {
  display: flex;
  gap: 10px;
  max-width: 960px;
}

.search-input-group {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 13px 42px 13px 16px;
  font-size: 15px;
  border-radius: 9px;
  border: 2px solid rgba(56, 189, 248, 0.4);
  background: #ffffff;
  color: var(--navy);
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  display: none;
}

.search-submit-btn {
  padding: 0 24px;
  border-radius: 9px;
  border: none;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-submit-btn:hover {
  background: #7dd3fc;
}

.quick-examples {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #cbd5e1;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
}

/* Collections Strip */
.collections-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 9px 24px;
  overflow-x: auto;
  white-space: nowrap;
}

.collections-inner {
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.partner-logo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  height: 38px;
  cursor: pointer;
  transition: all 0.15s;
}

.partner-logo-btn:hover,
.partner-logo-btn.active {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.18);
  transform: translateY(-1px);
}

.partner-logo-btn img {
  max-height: 24px;
  max-width: 92px;
  object-fit: contain;
}

.col-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.col-pill:hover,
.col-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Main Workspace Layout */
.workspace {
  max-width: 1480px;
  margin: 18px auto 48px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Filters */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.reset-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.reset-btn:hover {
  text-decoration: underline;
}

.caliper-box {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.caliper-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dim-row {
  display: grid;
  grid-template-columns: 78px 1fr 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.dim-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.caliper-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

.stock-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.apply-dim-btn {
  background: var(--navy);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.facet-block {
  border-bottom: 1px solid var(--border);
}

.facet-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 11px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.facet-body {
  padding: 0 16px 12px;
}

.facet-body.collapsed {
  display: none;
}

.facet-filter-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.facet-list {
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.facet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}

.facet-item:hover {
  background: var(--surface-alt);
  color: var(--navy);
}

.facet-item.selected {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.facet-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-light);
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Results Area */
.results-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.results-summary {
  font-size: 13.5px;
  color: var(--text-muted);
}

.results-summary strong {
  color: var(--navy);
}

.speed-badge {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--emerald-soft);
  color: var(--emerald);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

.active-tag button {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.active-tag button:hover {
  color: #ffffff;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.card-img-wrap {
  height: 185px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
}

.card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.stock-ribbon {
  position: absolute;
  top: 9px;
  left: 9px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.stock-ribbon.in {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.stock-ribbon.rfq {
  background: #e2e8f0;
  color: #475569;
}

.xref-count-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  background: var(--navy);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.card-body {
  padding: 13px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-code-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ff-code {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  font-family: var(--font-mono);
  cursor: pointer;
}

.ff-code:hover {
  color: var(--primary);
}

.primary-sku-tag {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-light);
}

.matched-banner {
  background: var(--amber-soft);
  color: #92400e;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: var(--font-mono);
}

.spec-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.spec-pill {
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.brand-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.brand-mini {
  font-size: 10.5px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price-label {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--navy);
  font-family: var(--font-mono);
}

.price-sub {
  font-size: 10.5px;
  color: var(--text-light);
  display: block;
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--navy);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary-sm {
  background: var(--primary);
  border: none;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary-sm:hover {
  background: var(--primary-dark);
}

/* Pagination */
.pagination {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 7px 13px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.page-btn.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modal & RFQ Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  background: var(--surface);
  border-radius: 14px;
  max-width: 1020px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.3);
}

.modal-header {
  padding: 16px 22px;
  background: var(--navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}

.modal-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 22px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
}

@media (max-width: 820px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.spec-table,
.variants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.spec-table th,
.spec-table td,
.variants-table th,
.variants-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.spec-table th {
  color: var(--text-muted);
  font-weight: 600;
  width: 46%;
  background: var(--surface-alt);
}

.variants-table th {
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  justify-content: flex-end;
  z-index: 1100;
}

.drawer-backdrop.open {
  display: flex;
}

.drawer-panel {
  width: 460px;
  max-width: 100%;
  background: var(--surface);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.25);
}

.drawer-body {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media print {
  .topbar,
  .hero-header,
  .collections-strip,
  .workspace,
  .modal-backdrop {
    display: none !important;
  }
  .drawer-backdrop {
    position: static !important;
    display: block !important;
    background: none !important;
  }
  .drawer-panel {
    width: 100% !important;
    box-shadow: none !important;
  }
}

