/* ==========================================
   NRCrobo 联核机器人 — Components
   ========================================== */

/* --- Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  transition: all 0.2s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-hover); }
.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:active { background: var(--brand-deepblue-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:active { background: var(--border-light); }
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
}
.btn-ghost:active { background: var(--border-light); }
.btn-sm { padding: 6px 14px; font-size: var(--text-sm); }
.btn-lg { padding: 14px 24px; font-size: var(--text-lg); }
.btn-xs { padding: 4px 10px; font-size: var(--text-xs); }
.btn-disabled, .btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Form --- */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-input.error { border-color: var(--danger); }
.form-error { font-size: var(--text-xs); color: var(--danger); margin-top: 4px; }
.form-textarea { min-height: 100px; resize: vertical; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6B7C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --- Step Progress --- */
.steps {
  display: flex;
  align-items: flex-start;
  padding: var(--space-4) 0;
}
.step-item {
  flex: 1;
  text-align: center;
  position: relative;
}
.step-item::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border-color);
}
.step-item:last-child::after { display: none; }
.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: var(--border-color);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}
.step-item.active .step-circle { background: var(--primary); color: #fff; }
.step-item.done .step-circle { background: var(--success); color: #fff; }
.step-item.done::after { background: var(--success); }
.step-item.active::after { background: var(--primary); }
.step-label { font-size: var(--text-xs); color: var(--text-muted); }
.step-item.active .step-label { color: var(--primary); font-weight: var(--weight-medium); }

/* --- Order Status Timeline --- */
.timeline { padding: var(--space-3) 0; }
.timeline-item {
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-5);
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  margin-top: 5px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-item.active .timeline-dot {
  width: 12px;
  height: 12px;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.timeline-item.done .timeline-dot { background: var(--success); }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 18px;
  width: 2px;
  height: calc(100% - 8px);
  background: var(--border-light);
}
.timeline-item:last-child::before { display: none; }
.timeline-content { flex: 1; }
.timeline-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.timeline-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.timeline-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Info Row (Profile/Detail) --- */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: var(--text-sm); color: var(--text-secondary); }
.info-value { font-size: var(--text-sm); color: var(--text-primary); font-weight: var(--weight-medium); text-align: right; }

/* --- List Menu (Settings Page) --- */
.list-menu { background: var(--bg-card); border-radius: var(--radius-md); overflow: hidden; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--border-light); }
.list-item-left { display: flex; align-items: center; gap: var(--space-3); }
.list-item-icon { width: 20px; height: 20px; color: var(--text-secondary); }
.list-item-icon svg { width: 20px; height: 20px; }
.list-item-text { font-size: var(--text-base); color: var(--text-primary); }
.list-item-right { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--text-sm); }
.list-item-arrow { color: var(--border-color); }

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-4);
  text-align: center;
}
.empty-state svg { width: 80px; height: 80px; color: var(--border-color); margin-bottom: var(--space-4); }
.empty-state-title { font-size: var(--text-lg); font-weight: var(--weight-medium); color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state-desc { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-6); }

/* --- Filter Tabs --- */
.filter-tabs {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  white-space: nowrap;
  transition: all 0.2s;
}
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-tab:active { transform: scale(0.95); }

/* --- Tab Switch (two-mode toggle) --- */
.tab-switch {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin: var(--space-3) var(--space-4);
  border: 1px solid var(--border-color);
}
.tab-switch-item {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  transition: all 0.25s;
}
.tab-switch-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(255,107,53,0.3);
}

/* --- Solution Card --- */
.solution-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.solution-card:active { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.solution-card-cover {
  width: 100%;
  height: 160px;
  background: var(--secondary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.solution-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.solution-card-body { padding: var(--space-4); }
.solution-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.solution-card-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.solution-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.solution-card-price {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--primary);
}
.solution-card-price .unit { font-size: var(--text-xs); font-weight: var(--weight-regular); }
.solution-card-tags {
  display: flex;
  gap: var(--space-1);
}

/* --- Bottom Action Bar (Fixed) --- */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-width);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-3);
  z-index: var(--z-header);
}
.action-bar .btn { flex: 1; }

/* --- Modal / Bottom Sheet --- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.overlay.show { opacity: 1; visibility: visible; }
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--content-max-width);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: var(--z-modal);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}
.bottom-sheet.show { transform: translateX(-50%) translateY(0); }
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin: var(--space-3) auto;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-light);
}
.bottom-sheet-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.bottom-sheet-body { padding: var(--space-4); }
.bottom-sheet-close { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text-muted); }
.bottom-sheet-close:active { background: var(--border-light); }

/* --- Score Gauge (Circular) --- */
.score-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border-light); }
.score-ring-value { fill: none; stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.score-text {
  position: absolute;
  text-align: center;
}
.score-number { font-size: var(--text-5xl); font-weight: var(--weight-bold); color: var(--text-primary); line-height: 1; }
.score-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* --- Toast --- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: var(--space-3) var(--space-6);
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  z-index: var(--z-toast);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border-color) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease infinite;
  border-radius: var(--radius-xs);
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Page Hero (for detail pages) --- */
.page-hero-sm {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  background: var(--bg-secondary);
}
.page-hero-sm h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.page-hero-sm p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --- Accordion / Collapse --- */
.accordion { }
.accordion-item { border-bottom: 1px solid var(--border-light); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  transition: background 0.2s;
}
.accordion-header:active { background: var(--border-light); }
.accordion-header svg { transition: transform 0.25s; color: var(--text-muted); }
.accordion-item.open .accordion-header svg { transform: rotate(180deg); }
.accordion-body {
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  display: none;
}
.accordion-item.open .accordion-body { display: block; }

/* ── 跟进结论/意向标签（CRM VER2 共用）── */
.f-tag{display:inline-block;padding:2px 9px;border-radius:6px;font-size:11px;font-weight:600;line-height:1.6;}

/* ── 身份显隐（供应商端「供货协同 / 店铺经营」双身份，配合 [data-mode] 使用）── */
.mode-hide{display:none !important;}
