/* ============================================================
   模具 AI 自動報價系統 — Demo CSS
   配色沿用 v2.1 流程圖：#1A2744 主深藍 · #ED7D31 橘 · #00AAAA 藍綠 · #375623 綠
   ============================================================ */

:root {
  --c-deep: #1a2744;
  --c-deep-2: #2e75b6;
  --c-deep-3: #93b4d4;
  --c-orange: #ed7d31;
  --c-orange-dark: #c96000;
  --c-teal: #00aaaa;
  --c-green: #375623;
  --c-bg: #eef2f7;
  --c-card: #ffffff;
  --c-line: #d8dfe8;
  --c-text: #1a2744;
  --c-text-2: #6b7280;
  --shadow: 0 4px 14px rgba(26, 39, 68, 0.08);
  --shadow-hi: 0 10px 28px rgba(26, 39, 68, 0.14);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: 'Microsoft JhengHei', 'Noto Sans TC', -apple-system, system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  font-size: 14px;
}
.hidden { display: none !important; }

/* =================== TOPBAR =================== */
.topbar {
  background: var(--c-deep);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .dot {
  width: 10px; height: 10px;
  background: var(--c-orange);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--c-orange);
}
.topbar .title { font-size: 16px; font-weight: 700; letter-spacing: 0.05em; }
.topbar .badge {
  background: var(--c-teal);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.topbar .meta { font-size: 11px; color: #93b4d4; }

/* =================== STEPPER =================== */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 18px 32px;
  border-bottom: 1px solid var(--c-line);
  gap: 0;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 6px;
  opacity: 0.45;
  transition: all 0.3s;
}
.stepper .step.active {
  opacity: 1;
  background: rgba(26, 39, 68, 0.05);
}
.stepper .step.done {
  opacity: 0.85;
}
.stepper .step i {
  display: flex;
  width: 28px; height: 28px;
  background: var(--c-deep);
  color: #fff;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}
.stepper .step.active i { background: var(--c-orange); box-shadow: 0 0 0 4px rgba(237, 125, 49, 0.18); }
.stepper .step.done i { background: var(--c-teal); }
.stepper .step b { font-size: 13px; font-weight: 700; display: block; }
.stepper .step span { font-size: 10px; color: var(--c-text-2); display: block; }
.stepper .line { width: 60px; height: 2px; background: var(--c-line); margin: 0 4px; }

/* =================== PAGE / CARD =================== */
.page {
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 24px;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.card {
  background: var(--c-card);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--c-line);
}
.card-head { border-bottom: 2px solid var(--c-deep); padding-bottom: 12px; margin-bottom: 18px; }
.card-head h2 { font-size: 18px; }
.card-head .card-sub { font-size: 12px; color: var(--c-text-2); margin-top: 4px; }
.card-foot { padding-top: 18px; border-top: 1px solid var(--c-line); margin-top: 18px; text-align: right; }

/* =================== BUTTONS =================== */
.btn-primary {
  display: inline-block;
  background: var(--c-orange);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--c-orange-dark); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(237, 125, 49, 0.35); }
.btn-ghost {
  background: transparent;
  color: var(--c-deep);
  border: 1px solid var(--c-line);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--c-deep); color: #fff; border-color: var(--c-deep); }

/* =================== STEP 1: UPLOAD =================== */
.upload-card {
  background: #fff;
  border: 2px dashed var(--c-deep-2);
  border-radius: 14px;
  padding: 56px 36px;
  text-align: center;
  transition: all 0.2s;
}
.upload-card.dragging {
  border-color: var(--c-orange);
  background: rgba(237, 125, 49, 0.04);
  transform: scale(1.01);
}
.upload-icon {
  font-size: 48px;
  color: var(--c-deep-2);
  margin-bottom: 14px;
  font-weight: 700;
}
.upload-card h2 { font-size: 22px; margin-bottom: 8px; }
.upload-card .hint { color: var(--c-text-2); font-size: 12px; margin-bottom: 24px; }
.upload-card .quick {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--c-text-2);
}
.upload-card .quick .quick-label {
  display: block;
  margin-top: 8px;
  font-weight: 600;
  color: var(--c-text);
}
.upload-card .quick .quick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}
.upload-card .quick .btn-feature {
  background: var(--c-orange);
  color: #fff;
  border-color: var(--c-orange);
  font-weight: 700;
}
.upload-card .quick .btn-feature:hover { background: var(--c-orange-dark); border-color: var(--c-orange-dark); }
.upload-card .quick .btn-real {
  border-color: var(--c-teal);
  color: var(--c-teal);
}
.upload-card .quick .btn-real:hover {
  background: var(--c-teal);
  color: #fff;
  border-color: var(--c-teal);
}

/* scenario banner on step 4 */
.scenario-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(0,170,170,0.08), rgba(46,117,182,0.04));
  border-left: 4px solid var(--c-teal);
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 12px;
}
.scenario-banner .banner-icon { font-size: 22px; }
.scenario-banner b { display: block; color: var(--c-deep); font-size: 14px; margin-bottom: 2px; }
.scenario-banner span { display: block; color: var(--c-text-2); font-size: 11px; margin-bottom: 6px; }
.scenario-banner small { display: block; color: var(--c-text-2); font-size: 10.5px; line-height: 1.7; }

/* AI confidence color */
.part-card .info .conf.conf-high { background: var(--c-teal); }
.part-card .info .conf.conf-mid { background: var(--c-orange); }
.part-card .info .conf.conf-low { background: #999; }
.part-card .info .reasoning {
  font-size: 10.5px;
  color: var(--c-text-2);
  font-style: italic;
  margin-top: 6px;
  border-top: 1px dashed var(--c-line);
  padding-top: 6px;
  cursor: help;
}

/* =================== STEP 2: SCREENSHOTS =================== */
.parts-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.parts-tabs .tab {
  padding: 7px 14px;
  border-radius: 5px;
  background: #f3f6fa;
  color: var(--c-text-2);
  cursor: pointer;
  font-size: 12px;
  border: 1px solid var(--c-line);
  display: flex;
  gap: 6px;
  align-items: center;
}
.parts-tabs .tab.active {
  background: var(--c-deep);
  color: #fff;
  border-color: var(--c-deep);
}
.parts-tabs .tab .qty { background: var(--c-orange); color: #fff; padding: 1px 6px; border-radius: 8px; font-size: 10px; }
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.screenshots-grid .shot {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: zoom-in;
  position: relative;
}
.screenshots-grid .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.screenshots-grid .shot:hover { border-color: var(--c-orange); transform: translateY(-2px); box-shadow: var(--shadow-hi); transition: all 0.15s; }

/* =================== STEP 3: AI =================== */
.analyze-card { padding: 60px 40px; text-align: center; }
.ai-runner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.orb {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--c-teal), var(--c-deep));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  margin-bottom: 16px;
  animation: orbPulse 2s infinite;
}
@keyframes orbPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 170, 170, 0.5); }
  50% { box-shadow: 0 0 0 18px rgba(0, 170, 170, 0); }
}
.orb-inner {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.6);
  border-top-color: var(--c-orange);
  animation: orbSpin 1.2s linear infinite;
}
@keyframes orbSpin { to { transform: rotate(360deg); } }
.ai-log {
  list-style: none;
  margin-top: 24px;
  text-align: left;
  font-size: 13px;
  color: var(--c-text);
  max-width: 480px;
  width: 100%;
}
.ai-log li {
  padding: 6px 12px;
  border-left: 3px solid var(--c-line);
  margin-bottom: 4px;
  color: var(--c-text-2);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  animation: slideIn 0.3s ease;
}
.ai-log li.done { border-left-color: var(--c-teal); color: var(--c-deep); }
.ai-log li.active { border-left-color: var(--c-orange); color: var(--c-orange-dark); font-weight: 700; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }

/* =================== STEP 4: QUOTE =================== */
.quote-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}
.quote-grid .full { grid-column: 1 / -1; }

/* parts result */
.part-card {
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fcfcfd;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
}
.part-card .thumb {
  width: 80px; height: 80px;
  background: var(--c-bg);
  border-radius: 6px;
  overflow: hidden;
}
.part-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.part-card .info b { font-size: 14px; }
.part-card .info .en { color: var(--c-text-2); font-size: 11px; margin-left: 6px; }
.part-card .info .meta { font-size: 11px; color: var(--c-text-2); margin-top: 4px; }
.part-card .info .conf {
  display: inline-block;
  background: var(--c-teal);
  color: #fff;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 10px;
  margin-left: 6px;
  font-weight: 700;
}
.part-card .qty-badge {
  text-align: right;
  font-size: 22px;
  font-weight: 700;
  color: var(--c-deep);
}
.part-card .qty-badge small { display: block; font-size: 10px; color: var(--c-text-2); font-weight: 400; }

/* totals */
.quote-summary .totals .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-line);
  font-size: 13px;
}
.quote-summary .totals .row b { font-variant-numeric: tabular-nums; }
.quote-summary .totals .row.grand {
  background: var(--c-deep);
  color: #fff;
  padding: 14px 16px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 17px;
  font-weight: 700;
  border: none;
}
.payment {
  background: rgba(237, 125, 49, 0.08);
  border-left: 4px solid var(--c-orange);
  padding: 12px 14px;
  margin: 18px 0;
  border-radius: 0 6px 6px 0;
}
.payment .pay-label { font-size: 11px; color: var(--c-text-2); }
.payment .pay-value { font-size: 14px; margin-top: 4px; }
.payment .pay-value b { color: var(--c-orange-dark); }
.quote-summary .btn-primary { width: 100%; text-align: center; margin-bottom: 8px; }
.quote-summary .btn-ghost { width: 100%; text-align: center; padding: 10px; }

/* ops table */
#opsTable {
  display: grid;
  gap: 16px;
}
.ops-block {
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.ops-block .ops-head {
  background: var(--c-deep);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ops-block .ops-head b { font-size: 14px; }
.ops-block .ops-head .right { font-size: 12px; }
.ops-block table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ops-block table th { background: #f3f6fa; padding: 8px 14px; text-align: left; font-weight: 700; color: var(--c-text-2); border-bottom: 1px solid var(--c-line); }
.ops-block table td { padding: 8px 14px; border-bottom: 1px solid #f0f3f7; }
.ops-block table tr:last-child td { border-bottom: none; }
.ops-block table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ops-block table tfoot td { background: #f7f9fc; font-weight: 700; font-size: 13px; }

/* footer */
.foot {
  text-align: center;
  font-size: 11px;
  color: var(--c-text-2);
  padding: 24px 12px;
}

/* ====== mobile ====== */
@media (max-width: 880px) {
  .stepper { padding: 10px 8px; flex-wrap: wrap; }
  .stepper .step { padding: 6px; }
  .stepper .line { width: 18px; }
  .quote-grid { grid-template-columns: 1fr; }
  .screenshots-grid { grid-template-columns: repeat(2, 1fr); }
}
