/* ============================================================
   API STD 1104-2021 Tools - Clean Modern Theme
   Rust/Orange primary: #8a3a1a / #a84d2a / #c0623a
   ============================================================ */

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

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f7f5f2;
  color: #2a2a2a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sticky Top Bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #5a2410 0%, #8a3a1a 100%);
  box-shadow: 0 2px 12px rgba(90, 36, 16, 0.35);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease;
}

.btn-top:hover {
  background: rgba(255, 255, 255, 0.30);
}

@media (max-width: 600px) {
  .btn-top .label-full { display: none; }
}

/* Language dropdown */
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 7px 34px 7px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  background-color: rgba(255, 255, 255, 0.95);
  color: #333;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'><path fill='%238a3a1a' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
  min-width: 130px;
  transition: background-color 0.15s;
}
.lang-select:hover { background-color: #fff; }
.lang-select:focus { outline: 2px solid #d49a6a; }

/* ---------- Container ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* ---------- Header ---------- */
.header {
  text-align: center;
  padding: 0 0 22px;
}

.header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: #5a2410;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

.header .subtitle {
  font-size: 1rem;
  color: #8a6a5a;
  font-weight: 500;
}

/* ---------- Tabs ---------- */
.tab-wrap {
  display: flex;
  gap: 0;
  border-bottom: 2.5px solid #d8c8bb;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  min-width: 110px;
  padding: 13px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  background: transparent;
  color: #7a5a4a;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -2.5px;
}

.tab-btn:hover {
  color: #8a3a1a;
}

.tab-btn.active {
  color: #8a3a1a;
  border-bottom-color: #8a3a1a;
}

@media (max-width: 600px) {
  .tab-btn { font-size: 0.8rem; padding: 11px 8px; min-width: 80px; }
}

/* ---------- Panel (card) ---------- */
.tab-panel {
  display: none;
  background: #ffffff;
  border: 1px solid #e4dcd4;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 28px 26px 30px;
  box-shadow: 0 4px 16px rgba(90, 36, 16, 0.06);
}

.tab-panel.active {
  display: block;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #5a2410;
  margin-bottom: 6px;
}

.panel-intro {
  font-size: 0.92rem;
  color: #6a5a4a;
  margin-bottom: 22px;
  line-height: 1.65;
}

@media (max-width: 600px) {
  .tab-panel { padding: 20px 14px 22px; }
}

/* ---------- Form layout ---------- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.form-group.cols-2 {
  min-width: calc(50% - 9px);
  flex: 1 1 calc(50% - 9px);
}

.form-group.cols-3 {
  min-width: calc(33.33% - 12px);
  flex: 1 1 calc(33.33% - 12px);
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3a3a3a;
}

.form-group label .hint {
  color: #9a8a7a;
  font-weight: 400;
  font-size: 0.82rem;
  margin-left: 4px;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d8cdc4;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #2a2a2a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #c0623a;
  outline: none;
  box-shadow: 0 0 0 3px rgba(192, 98, 58, 0.15);
}

/* Placeholder text */
.form-group input::placeholder {
  color: #c0b0a0;
}

/* Radio row */
.radio-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 16px;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.92rem;
}

/* Section divider inside a panel */
.section-divider {
  border: none;
  border-top: 1px solid #ece4dc;
  margin: 8px 0 18px;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a3a1a;
  margin: 18px 0 12px;
}

@media (max-width: 600px) {
  .form-group { min-width: 100%; flex: 1 1 100%; }
  .form-group.cols-2, .form-group.cols-3 { min-width: 100%; flex: 1 1 100%; }
}

/* ---------- Calculate Button ---------- */
.calc-btn-wrap {
  margin-top: 8px;
  padding-top: 6px;
}

.calc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 30px;
  background: linear-gradient(135deg, #8a3a1a 0%, #a84d2a 100%);
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(138, 58, 26, 0.28);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(138, 58, 26, 0.35);
}

.calc-btn:active {
  transform: translateY(0);
}

/* ---------- Result box ---------- */
.result {
  margin-top: 22px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  transition: padding 0.2s;
}

.result.show {
  padding: 20px 22px;
}

.result.pass {
  background: #f1f8ed;
  border: 1.5px solid #aed59f;
}

.result.fail {
  background: #fdecea;
  border: 1.5px solid #e9a89a;
}

.result.info {
  background: #faf6f1;
  border: 1.5px solid #d8c8bb;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.result.pass .result-title { color: #2e7d32; }
.result.fail .result-title { color: #c62828; }
.result.info .result-title { color: #5a2410; }

.result-detail {
  font-size: 0.94rem;
  line-height: 1.75;
  color: #333;
  white-space: pre-wrap;
}

/* Condition list (per-criterion checks) */
.cond-list {
  list-style: none;
  padding-left: 0;
  margin: 6px 0;
}

.cond-list li {
  padding: 5px 0;
  font-size: 0.92rem;
}

.cond-list li.ok { color: #2e7d32; }
.cond-list li.bad { color: #c62828; font-weight: 600; }

/* Result item rows (IQI / lookup results) */
.result-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(90, 36, 16, 0.10);
  font-size: 0.94rem;
}

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

.result-item .result-label {
  color: #5a2410;
  font-weight: 600;
  margin-right: 4px;
}

.result-item strong {
  color: #1a1a1a;
}

/* Hardness / Specimen / IQI table */
.hard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.92rem;
}

.hard-table th,
.hard-table td {
  padding: 9px 14px;
  border: 1px solid #d8c8bb;
  text-align: center;
}

.hard-table th {
  background: #f3e8e0;
  color: #5a2410;
  font-weight: 600;
  font-size: 0.86rem;
}

.hard-table td {
  background: #fff;
}

/* Note box */
.note-box {
  background: #faf7f4;
  border-left: 4px solid #c0623a;
  padding: 11px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: #5a4a3a;
  line-height: 1.6;
  border-radius: 0 6px 6px 0;
}

/* Footer data source */
.data-source {
  text-align: center;
  font-size: 0.82rem;
  color: #b0a090;
  margin-top: 32px;
  padding: 8px 0;
}