/* ===================================================================
   结构专业常用截面型钢防火保护层厚度计算系统 - 专业样式表
   依据标准: 《石油化工构筑物结构耐火设计标准》SH/T 3137-2025
=================================================================== */

:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --secondary: #0f172a;
  --fire: #ea580c;
  --fire-glow: rgba(234, 88, 12, 0.15);
  --fire-light: #fff7ed;
  --fire-border: #fed7aa;
  --safe: #059669;
  --safe-light: #ecfdf5;
  --safe-border: #a7f3d0;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 顶部导航与页眉 */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-standard {
  background-color: #f1f5f9;
  color: #0284c7;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #e0f2fe;
}

.nav-tabs {
  display: flex;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.nav-tab-btn {
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.5);
}

.nav-tab-btn.active {
  background-color: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 主容器 */
.main-content {
  max-width: 1440px;
  margin: 1.25rem auto;
  padding: 0 1.5rem;
}

/* 栅格与卡片 */
.grid-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.65rem;
}

.card-title-text {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* 表单控件 */
.form-group {
  margin-bottom: 0.95rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-label-desc {
  font-weight: normal;
  color: var(--text-muted);
  font-size: 0.74rem;
  margin-left: 0.25rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.48rem 0.75rem;
  font-size: 0.86rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.form-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.5rem;
}

/* 按钮组与切换胶囊 */
.segmented-control {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.segmented-btn {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.segmented-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 受火工况选择卡片 */
.fire-condition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.fire-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  text-align: center;
}

.fire-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.fire-card.active {
  border-color: var(--fire);
  background: var(--fire-light);
}

.fire-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.fire-card.active .fire-card-title {
  color: var(--fire);
}

.fire-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* 滑块控件组合 */
.slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-group input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.slider-group .slider-input {
  width: 75px;
  text-align: center;
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-outline {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-outline:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

.btn-danger-outline {
  background-color: #ffffff;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-danger-outline:hover {
  background-color: #fef2f2;
}

.btn-sm {
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
}

/* 结果高亮大卡片 */
.result-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 60%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(29, 78, 216, 0.25);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .result-banner {
    grid-template-columns: 1fr;
  }
}

.result-main-val {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.result-main-unit {
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0.85;
}

.result-sub-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.result-sub-item {
  font-size: 0.82rem;
  opacity: 0.92;
}

.result-sub-item strong {
  font-size: 0.95rem;
  margin-left: 0.25rem;
}

.result-recommend-box {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  text-align: center;
}

.result-recommend-label {
  font-size: 0.74rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-recommend-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fef08a;
}

/* 参数仪表卡片组 */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

.metric-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-card-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.metric-card-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 0.15rem;
}

/* 截面SVG图示区 */
.svg-preview-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.svg-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.85rem;
  font-size: 0.76rem;
  color: #475569;
  background: #ffffff;
  padding: 0.35rem 0.95rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* 计算推导步骤 */
.steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.step-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  border-left: 4px solid var(--primary);
  font-size: 0.84rem;
}

.step-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-formula {
  background: #f8fafc;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.82rem;
  color: #0369a1;
  margin: 0.35rem 0;
  overflow-x: auto;
  border: 1px dashed #cbd5e1;
}

.step-sub-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* 警示框 */
.alert-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.alert-warning {
  background-color: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

.alert-info {
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: #1e40af;
}

/* 批量表格 */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

.data-table tr.active td {
  background-color: #eff6ff;
}

/* 批量计算表：截面未匹配标准库、待人工选择规格的构件行（红底标记） */
.data-table tr.row-needs-manual td {
  background-color: #fef2f2;
}

.data-table tr.row-needs-manual:hover td {
  background-color: #fee2e2;
}

.data-table input, .data-table select {
  font-size: 0.8rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  width: 100%;
}

.th-highlight {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

.td-highlight {
  font-weight: 700;
  color: #1e40af;
  background-color: #eff6ff;
}

/* 徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.tag-fire-4 {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.tag-fire-3 {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* 知识库报告卡片 */
.report-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #ffffff;
  margin-bottom: 1rem;
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.report-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

/* 计算书打印模式专用样式 */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 10pt;
  }

  .app-header, .nav-tabs, .btn, .no-print, .segmented-control, .fire-condition-grid {
    display: none !important;
  }

  .main-content {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

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

  .card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
  }

  .result-banner {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border: 2px solid #000000;
    box-shadow: none;
  }

  .result-main-val {
    color: #000000;
  }

  .result-recommend-val {
    color: #000000;
  }

  .step-formula {
    border: 1px solid #94a3b8;
    background: #f8fafc;
    color: #000000;
  }

  .data-table th {
    background: #e2e8f0 !important;
    color: #000000;
    border: 1px solid #000000;
  }

  .data-table td {
    border: 1px solid #000000;
    color: #000000;
  }
}
