/* =============================================================================
   电商税务计算器 v3 — 暗色主题样式
   基于慕有枝税务课程(900+案例)
   ============================================================================= */

/* ── CSS 变量 ──────────────────────────────────────────────────────────── */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #0f172a;
  --border: #334155;
  --border-focus: #38bdf8;
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #38bdf8;
  --orange: #f97316;
  --alert-bg: #422006;
  --alert-color: #fbbf24;
  --alert-danger-bg: #450a0a;
  --alert-danger-color: #f87171;
  --alert-ok-bg: #064e3b;
  --alert-ok-color: #6ee7b7;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 720px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-secondary);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────────────── */
h1 {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Step Cards ─────────────────────────────────────────────────────────── */
.step {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.step-title {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Form Fields ────────────────────────────────────────────────────────── */
.field {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.field > label {
  color: var(--text-muted);
  font-size: 13px;
  min-width: 80px;
  white-space: nowrap;
}

.field > input,
.field > select {
  flex: 1;
  min-width: 100px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.field > input:focus,
.field > select:focus {
  border-color: var(--border-focus);
}

.field > input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.field > .unit {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Radio / Checkbox groups ──────────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.radio-group label {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.4;
}

.radio-group input[type="radio"],
.radio-group input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 14px;
  width: auto;
}

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

/* ── Result Rows ─────────────────────────────────────────────────────────── */
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: center;
}

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

.result-row .key {
  color: var(--text-muted);
}

.result-row .val {
  font-weight: 700;
  color: var(--text-primary);
}

.result-row.total-row {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
}

/* ── Text Colors ────────────────────────────────────────────────────────── */
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }
.blue { color: var(--blue); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

.big-num {
  font-size: 26px;
  font-weight: 800;
}

/* ── Alert Boxes ─────────────────────────────────────────────────────────── */
.alert {
  background: var(--alert-bg);
  color: var(--alert-color);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.alert-danger {
  background: var(--alert-danger-bg);
  color: var(--alert-danger-color);
}

.alert-ok {
  background: var(--alert-ok-bg);
  color: var(--alert-ok-color);
}

/* ── Hint Text ──────────────────────────────────────────────────────────── */
.hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--text-muted);
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--bg-secondary);
  color: var(--text-secondary);
}

/* ── Loading Spinner ─────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ── Cost Input Grid ─────────────────────────────────────────────────── */
.costs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.costs-grid .field {
  margin-bottom: 0;
}

/* ── Diagnosis Results ────────────────────────────────────────────────── */
.diagnosis-card {
  margin-bottom: 8px;
}

.diagnosis-card:last-child {
  margin-bottom: 0;
}

/* ── Textarea ─────────────────────────────────────────────────────────── */
textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  font-size: 13px;
  min-height: 50px;
  outline: none;
  resize: vertical;
  font-family: var(--font);
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--border-focus);
}

/* ── Section Divider ──────────────────────────────────────────────────── */
.section-label {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  color: #475569;
  font-size: 11px;
  margin-top: 20px;
  padding-bottom: 40px;
  line-height: 1.6;
}

.footer .highlight {
  color: var(--accent-light);
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  body {
    padding: 10px;
  }

  .step {
    padding: 14px;
  }

  .costs-grid {
    grid-template-columns: 1fr;
  }

  .field > label {
    min-width: 100%;
    margin-bottom: 2px;
  }

  .field > input,
  .field > select {
    min-width: 0;
  }

  .radio-group {
    gap: 10px;
  }

  .radio-group label {
    font-size: 12px;
  }

  .result-row {
    font-size: 13px;
  }

  .big-num {
    font-size: 22px;
  }
}

@media (max-width: 380px) {
  .step-title {
    font-size: 14px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}
