/* QA Platform global styles (v20260127) */

:root {
  --qa-bg: #f4f7fb;
  --qa-surface: #ffffff;
  --qa-border: rgba(15, 23, 42, 0.1);
  --qa-text: #0f172a;
  --qa-muted: #64748b;
  --qa-primary: #2563eb;
  --qa-primary-soft: rgba(37, 99, 235, 0.1);
  --qa-success: #16a34a;
  --qa-warning: #d97706;
  --qa-danger: #dc2626;
  --qa-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --qa-radius: 16px;
}

html, body {
  height: 100%;
}

body.app-body {
  background: linear-gradient(180deg, #f8fbff 0%, var(--qa-bg) 220px, var(--qa-bg) 100%);
  color: var(--qa-text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

/* Navigation */
.app-nav {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--qa-border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

.app-nav .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  color: var(--qa-text) !important;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.brand-text {
  letter-spacing: 0.2px;
}

.app-nav .navbar-collapse {
  align-items: center;
}

.app-nav-menu {
  align-items: center;
}

.app-nav .nav-link {
  color: rgba(15, 23, 42, 0.72);
  font-weight: 600;
  border-radius: 10px;
  padding: 0.45rem 0.75rem !important;
  transition: color 0.15s ease, background 0.15s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
  color: var(--qa-primary);
  background: rgba(37, 99, 235, 0.06);
}

.app-nav .nav-link.active {
  color: var(--qa-primary) !important;
  background: var(--qa-primary-soft);
}

@media (min-width: 992px) {
  .app-nav-menu {
    display: flex;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    justify-content: space-between;
    gap: 0.12rem;
    min-width: 0;
    margin-left: 0.35rem;
    margin-right: 0.35rem;
  }

  .app-nav-menu > .nav-item {
    flex: 1 1 0;
    min-width: 0;
  }

  .app-nav-menu > .nav-item > .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    white-space: nowrap;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    padding: 0.42rem 0.3rem !important;
  }

  .app-nav .navbar-brand {
    flex-shrink: 0;
  }

  .app-nav .navbar-nav:last-child {
    flex-shrink: 0;
  }
}

.nav-feature-ai-generate {
  color: #7c3aed !important;
}

.nav-feature-ai-generate:hover,
.nav-feature-ai-generate:focus,
.nav-feature-ai-generate.active {
  color: #6d28d9 !important;
  background: rgba(124, 58, 237, 0.08) !important;
}

.nav-feature-ai-test {
  color: #2563eb !important;
}

.nav-feature-ai-test:hover,
.nav-feature-ai-test:focus,
.nav-feature-ai-test.active {
  color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.nav-feature-coverage {
  color: #0d9488 !important;
}

.nav-feature-coverage:hover,
.nav-feature-coverage:focus,
.nav-feature-coverage.active {
  color: #0f766e !important;
  background: rgba(13, 148, 136, 0.08) !important;
}

.nav-feature-report {
  color: #0891b2 !important;
}

.nav-feature-report:hover,
.nav-feature-report:focus,
.nav-feature-report.active {
  color: #0e7490 !important;
  background: rgba(8, 145, 178, 0.08) !important;
}

.beta-badge {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #b45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Page header */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--qa-muted);
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

/* Cards */
.card {
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius);
  box-shadow: var(--qa-shadow);
  background: var(--qa-surface);
}

.card-header {
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid var(--qa-border);
  font-weight: 700;
}

/* Stat cards */
.stat-grid .card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stat-label {
  color: var(--qa-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* Home feature cards */
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-feature-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--qa-radius);
  border: 1px solid var(--qa-border);
  background: var(--qa-surface);
  box-shadow: var(--qa-shadow);
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
  color: inherit;
}

.home-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex: 0 0 auto;
}

.home-feature-body {
  flex: 1 1 auto;
  min-width: 0;
}

.home-feature-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
}

.home-feature-subtitle {
  color: var(--qa-muted);
  font-size: 0.88rem;
}

.home-feature-arrow {
  color: rgba(15, 23, 42, 0.35);
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.feature-ai-test .home-feature-icon {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.feature-ai-generate .home-feature-icon {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.feature-report .home-feature-icon {
  background: rgba(8, 145, 178, 0.12);
  color: #0891b2;
}

.feature-ai-test:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.feature-ai-generate:hover {
  border-color: rgba(124, 58, 237, 0.35);
}

.feature-report:hover {
  border-color: rgba(8, 145, 178, 0.35);
}

/* Report / network helpers (shared with inline blocks) */
.net-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.net-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.net-pill {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.03);
  color: rgba(15, 23, 42, 0.7);
}

.net-box {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
}

.net-pre {
  max-height: 360px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.03);
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(15, 23, 42, 0.78);
}

.net-actions {
  display: flex;
  gap: 8px;
}

.ai-pre {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.78);
  max-height: 420px;
  overflow: auto;
}

.ai-rich {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(15, 23, 42, 0.84);
}

.ai-rich .k-bad { color: #dc2626; font-weight: 600; }
.ai-rich .k-warn { color: #d97706; font-weight: 600; }
.ai-rich .k-good { color: #16a34a; font-weight: 600; }
.ai-rich .k-info { color: #2563eb; font-weight: 600; }
.ai-rich .k-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

/* Tables */
.table > :not(caption) > * > * {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

/* 需求列表表头与列宽（表头/数据列 class 一致，fixed 布局保证对齐） */
.req-list-table {
  table-layout: fixed;
  width: 100%;
}

.req-list-table thead th,
.req-list-table tbody td {
  vertical-align: middle;
  padding: 0.65rem 0.5rem;
  box-sizing: border-box;
}

.req-list-table thead th {
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.72);
  background: rgba(248, 250, 252, 0.95);
  border-bottom: 2px solid rgba(15, 23, 42, 0.1);
  white-space: nowrap;
}

.req-list-table .req-col-check { width: 42px; min-width: 42px; max-width: 42px; }
.req-list-table .req-col-id { width: 56px; min-width: 56px; max-width: 56px; }
.req-list-table .req-col-title { width: 16%; min-width: 120px; }
.req-list-table .req-col-project { width: 9%; min-width: 80px; }
.req-list-table .req-col-type { width: 72px; min-width: 72px; max-width: 72px; }
.req-list-table .req-col-priority { width: 72px; min-width: 72px; max-width: 72px; }
.req-list-table .req-col-status { width: 80px; min-width: 80px; max-width: 80px; }
.req-list-table .req-col-docs { width: 260px; min-width: 240px; }
.req-list-table .req-col-creator { width: 88px; min-width: 88px; max-width: 88px; }
.req-list-table .req-col-time { width: 128px; min-width: 128px; max-width: 128px; }
.req-list-table .req-col-actions { width: 220px; min-width: 210px; }

.req-list-table .req-col-title {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-list-table .req-col-actions {
  white-space: nowrap;
}

.req-list-table .req-col-actions .btn {
  margin: 0 1px;
}

.req-list-table .req-docs-cell .req-doc-item-row {
  justify-content: flex-start;
}

.req-list-table .req-docs-cell .req-doc-actions {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 991.98px) {
  .home-feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .page-title {
    font-size: 1.45rem;
  }

  .stat-value {
    font-size: 1.45rem;
  }
}

/* Toast */
.qa-toast {
  min-width: 280px;
  box-shadow: var(--qa-shadow);
  border-radius: 12px;
  overflow: hidden;
}

.qa-toast-success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
}

.qa-toast-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}

/* 需求文档列 */
.req-doc-item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  line-height: 1.45;
}

.req-doc-name {
  max-width: min(220px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--qa-text);
}

.req-doc-time {
  font-size: 0.75rem;
  white-space: nowrap;
}

.req-doc-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.req-doc-actions .btn {
  font-size: 0.75rem;
  line-height: 1.3;
}

.req-doc-preview-body {
  min-height: 60vh;
  background: rgba(15, 23, 42, 0.02);
}

.req-doc-preview-frame {
  width: 100%;
  min-height: 60vh;
  border: 0;
  display: block;
}

.req-doc-preview-html {
  max-height: 70vh;
  overflow: auto;
}

.req-doc-preview-docx {
  font-size: 14px;
  line-height: 1.6;
  color: var(--qa-text);
}

.req-doc-preview-xlsx table {
  font-size: 13px;
}

.req-doc-preview-xlsx th,
.req-doc-preview-xlsx td {
  border: 1px solid var(--qa-border);
  padding: 6px 8px;
}
