:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #64748b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --pharma-green: #059669;
  --pharma-green-bg: #ecfdf5;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 32px rgba(2, 132, 199, 0.14);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #059669);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  display: block;
  letter-spacing: -0.02em;
}

.brand-highlight {
  color: var(--primary);
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
}

.product-counter {
  font-size: 0.82rem;
  color: var(--text-sub);
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 500;
}

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.search-hero {
  text-align: center;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.hero-desc {
  font-size: 0.94rem;
  color: var(--text-sub);
  margin-bottom: 20px;
}

/* Search Box */
.search-box-wrapper {
  position: relative;
  max-width: 780px;
  margin: 0 auto 14px;
}

.search-input-container {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.search-input-container:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.search-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  margin-right: 10px;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.02rem;
  color: var(--text-main);
  background: transparent;
  padding: 8px 0;
}

.clear-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 50%;
}

.clear-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.search-btn {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.search-btn:hover {
  opacity: 0.93;
}

/* Autocomplete Dropdown */
.suggest-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  z-index: 40;
  text-align: left;
  overflow: hidden;
}

.suggest-item {
  padding: 11px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.suggest-item:last-child {
  border-bottom: none;
}

.suggest-item:hover {
  background: #f0f9ff;
}

.suggest-name {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--text-main);
}

.suggest-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.suggest-price {
  font-weight: 700;
  color: var(--pharma-green);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Popular Quick Tags */
.quick-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 820px;
  margin: 0 auto;
}

.quick-tags-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tag-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f9ff;
}

/* Subtle Google-like Suggestion Notice Bar */
.search-notice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.86rem;
}

.notice-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-sub);
}

.notice-right {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.suggest-link-chip {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: var(--primary-dark);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
}

.suggest-link-chip:hover {
  background: #e0f2fe;
}

/* Production Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.product-card.top-rank-1 {
  border-color: #7dd3fc;
}

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

/* Clickable #STT Badge for On-Demand Technical Inspection */
.rank-badge {
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rank-badge:hover {
  background: #0f172a;
  color: #ffffff;
  transform: scale(1.05);
}

.rank-badge.rank-1 {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.rank-badge.rank-1:hover {
  background: #0284c7;
  color: #ffffff;
}

.unit-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 6px;
}

.product-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.4;
}

mark.hl {
  background: #fef9c3;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 700;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.meta-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 2px 8px;
  border-radius: 6px;
}

.indication-box {
  font-size: 0.81rem;
  color: var(--text-sub);
  background: #f8fafc;
  border-left: 3px solid #10b981;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.price-tag {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--pharma-green);
}

.unit-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.tech-modal-card {
  max-width: 680px;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  background: #f8fafc;
}

.tech-modal-header {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
}

.tech-rank-pill {
  display: inline-block;
  background: #38bdf8;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.modal-id-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close-btn {
  border: none;
  background: rgba(148, 163, 184, 0.25);
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.modal-stat {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
}

.modal-stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.modal-stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-desc-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  white-space: pre-line;
  color: #1e293b;
}

/* Technical Breakdown Table inside #STT Modal */
.tech-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 14px 0 8px;
}

.tech-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.tech-score-row:last-child {
  border-bottom: none;
}

.tech-score-val {
  font-weight: 700;
  color: var(--primary-dark);
}

.tech-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 12px;
}

.tech-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
}

/* Loading */
.loading-state {
  text-align: center;
  padding: 36px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}
