/* 中小企业数智化改造项目摸查平台 - 主样式 */

:root {
  --brand-primary: #0d5caf;
  --base-font-size: 16px;
}

html {
  /* -webkit-text-size-adjust: 100% 防止 iOS 横屏时字体被自动放大 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: #f5f7fa;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: var(--base-font-size);
  line-height: 1.6;
}

.navbar-dark.bg-primary {
  background-color: var(--brand-primary) !important;
}

.card {
  border: none;
  border-radius: 8px;
}

.card-title {
  color: var(--brand-primary);
}

.table > :not(caption) > * > * {
  padding: 0.5rem 0.75rem;
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.2rem rgba(13, 92, 175, 0.15);
}

.text-primary {
  color: var(--brand-primary) !important;
}

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

.btn-primary:hover {
  background-color: #0a4d8f;
  border-color: #0a4d8f;
}

.btn-outline-primary {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

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

.form-check-inline {
  margin-right: 1rem;
}

.form-check-inline .form-check-input {
  margin-right: 0.3rem;
}

/* 错误弹窗：红框 + 红色加粗字体 */
.alert.alert-danger {
  border: 2px solid #dc3545 !important;
  color: #842029 !important;
  font-weight: 600 !important;
  background-color: #fff5f5 !important;
}

small.text-muted,
.form-text {
  color: #888;
}

/* 进度条 */
.progress {
  background-color: #e9ecef;
}

/* 表格 hover 强调 */
.table-hover tbody tr:hover {
  background-color: rgba(13, 92, 175, 0.04);
}

/* 响应式：手机端优化 */
@media (max-width: 768px) {
  :root {
    --base-font-size: 16px;
  }
  body {
    font-size: var(--base-font-size);
  }
  /* 标题随屏幕等比缩放 */
  h1 { font-size: calc(var(--base-font-size) * 1.8); }
  h2 { font-size: calc(var(--base-font-size) * 1.5); }
  h3 { font-size: calc(var(--base-font-size) * 1.3); }
  h4, .card-title { font-size: calc(var(--base-font-size) * 1.15); }
  h5 { font-size: calc(var(--base-font-size) * 1.05); }
  h6 { font-size: var(--base-font-size); }
  h2.fs-5 { font-size: calc(var(--base-font-size) * 1.05) !important; }

  .form-label {
    font-size: calc(var(--base-font-size) * 1.05);
    margin-bottom: 0.4rem;
  }
  /* 输入框保持 16px，防止 iOS Safari 聚焦时自动放大 */
  .form-control,
  .form-select,
  textarea,
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px;
  }
  .btn {
    font-size: var(--base-font-size);
    padding: 0.5rem 1rem;
  }
  .form-text,
  small.text-muted,
  small {
    font-size: calc(var(--base-font-size) * 0.9);
  }
  .navbar-brand {
    font-size: calc(var(--base-font-size) * 1.0);
  }
  .navbar-brand img {
    width: 26px;
    height: 26px;
  }
  .nav-link {
    font-size: var(--base-font-size);
  }

  .form-check-inline {
    display: block;
    margin-right: 0;
    margin-bottom: 0.5rem;
    width: 100%;
    font-size: var(--base-font-size);
  }
  .form-check-inline input[type="checkbox"],
  .form-check-inline input[type="radio"] {
    margin-right: 0.4rem;
    width: 18px;
    height: 18px;
  }
  .form-check-label {
    font-size: var(--base-font-size);
  }

  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .card-body {
    padding: 1rem;
  }
  /* 表格字体保持可读大小 */
  .table {
    font-size: calc(var(--base-font-size) * 0.95);
  }
  .table > :not(caption) > * > * {
    padding: 0.45rem 0.6rem;
  }
  .step-indicator {
    padding: 10px 5px;
    font-size: calc(var(--base-font-size) * 0.9);
  }
  .step-number {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: calc(var(--base-font-size) * 0.95);
  }
  .step-label {
    font-size: calc(var(--base-font-size) * 0.85);
  }
  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 0.5rem;
  }
  .d-flex.justify-content-between > div {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .d-flex.justify-content-between .btn {
    flex: 1;
    min-width: 120px;
  }
  .row.g-2.mb-3 {
    flex-direction: column;
  }
  .row.g-2.mb-3 > .col-auto {
    width: 100%;
  }
  .row.g-2.mb-3 .form-control,
  .row.g-2.mb-3 .form-select {
    width: 100%;
  }
  /* 大文本输入框在手机上给足高度 */
  textarea.form-control {
    min-height: 120px;
  }
  footer small {
    font-size: calc(var(--base-font-size) * 0.85);
  }
}

@media (max-width: 576px) {
  :root {
    --base-font-size: 15px;
  }
  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  /* 超小屏下表单元素仍保持 16px，避免 iOS 聚焦放大 */
  .form-control,
  .form-select,
  textarea,
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px;
  }
}
