/**
 * report-page.css — 报告中心页面样式
 * 所有样式以 .report- 为前缀，限定在 #page-report 内
 * ============================================================================
 */

/* ==========================================================================
   Layout
   ========================================================================== */

#page-report {
  background: var(--bg-page);
  position: relative;
}

#page-report .report-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100% - 34px);
  overflow: hidden;
}

/* ==========================================================================
   Stats Row
   ========================================================================== */

.report-stats-row {
  display: flex;
  gap: 10px;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}

.report-stat-card {
  flex: 1;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.report-stat-num {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.report-stat-num.warn  { color: #D97706; }
.report-stat-num.good  { color: var(--state-ok); }
.report-stat-num.info  { color: #0891B2; }

/* ==========================================================================
   Body (sidebar + content)
   ========================================================================== */

.report-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ==========================================================================
   Sidebar (300px)
   ========================================================================== */

.report-sidebar {
  width: 300px;
  min-width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #F4F6F9;
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.report-sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.report-sidebar-header svg { color: #0891B2; }

/* New button */
.report-btn-area {
  padding: 6px 12px;
  position: relative;
  flex-shrink: 0;
}

.report-btn-new {
  width: 100%;
  padding: 9px 12px;
  background: #0891B2;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.report-btn-new:hover { background: #0E7490; box-shadow: 0 2px 8px rgba(8,145,178,0.25); }
.report-btn-new:active { transform: scale(0.97); }

.report-new-menu {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 10;
  overflow: hidden;
}

.report-new-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition-fast);
}

.report-new-menu button:hover { background: var(--bg-hover); color: var(--text-primary); }
.report-new-menu button:last-child { border-bottom: none; }

/* Filter */
.report-filter-row {
  padding: 6px 12px;
  flex-shrink: 0;
}

.report-filter-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

/* List */
.report-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 8px;
}

.report-list::-webkit-scrollbar { width: 3px; }
.report-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.report-list-item {
  padding: 11px 12px;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.report-list-item:hover { border-color: var(--border-default); }
.report-list-item.active { border-color: #0891B2; background: rgba(8,145,178,0.03); }

.report-list-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}

.report-list-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-list-item-badges {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.report-badge {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.report-badge.draft    { background: rgba(100,116,139,0.1); color: #64748B; }
.report-badge.pending  { background: rgba(245,158,11,0.1); color: #D97706; }
.report-badge.approved { background: rgba(16,185,129,0.1); color: #059669; }
.report-badge.rejected { background: rgba(239,68,68,0.1); color: #DC2626; }
.report-badge.archived { background: rgba(139,92,246,0.1); color: #7C3AED; }
.report-badge.risk-warn  { background: rgba(245,158,11,0.1); color: #D97706; }
.report-badge.risk-crit  { background: rgba(239,68,68,0.1); color: #DC2626; }
.report-badge.risk-normal { background: rgba(16,185,129,0.1); color: #059669; }

.report-list-item-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   Content Area
   ========================================================================== */

.report-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  min-width: 0;
}

.report-content::-webkit-scrollbar { width: 5px; }
.report-content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.report-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  gap: 16px;
}

/* Report header */
.report-view-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--text-primary);
}

.report-view-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.report-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.report-view-meta span { white-space: nowrap; }

/* Action bar */
.report-action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.report-action-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.report-action-btn.edit    { background: rgba(59,130,246,0.08); color: #2563EB; }
.report-action-btn.edit:hover    { background: rgba(59,130,246,0.15); }
.report-action-btn.submit  { background: #D97706; color: #fff; }
.report-action-btn.submit:hover  { background: #B45309; }
.report-action-btn.approve { background: rgba(16,185,129,0.1); color: #059669; }
.report-action-btn.approve:hover { background: rgba(16,185,129,0.2); }
.report-action-btn.reject  { background: rgba(239,68,68,0.08); color: #DC2626; }
.report-action-btn.reject:hover  { background: rgba(239,68,68,0.15); }
.report-action-btn.print   { background: var(--bg-input); color: var(--text-secondary); }
.report-action-btn.print:hover   { color: var(--text-primary); }
.report-action-btn.copy    { background: var(--bg-input); color: var(--text-secondary); }
.report-action-btn.copy:hover    { color: var(--text-primary); }
.report-action-btn.delete  { background: transparent; color: var(--text-muted); border: 1px solid var(--border-default); }
.report-action-btn.delete:hover  { border-color: #DC2626; color: #DC2626; }
.report-action-btn:active  { transform: scale(0.97); }

/* Section */
.report-section {
  margin-bottom: 16px;
}

.report-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 3px solid #0891B2;
  padding-left: 10px;
  margin-bottom: 8px;
}

.report-section-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding-left: 13px;
}

/* Edit mode */
.report-edit-title {
  width: 100%;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: inherit;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.report-edit-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: inherit;
  color: var(--text-secondary);
  line-height: 1.7;
  resize: vertical;
  min-height: 60px;
}

.report-edit-textarea:focus,
.report-edit-title:focus {
  outline: none;
  border-color: #0891B2;
  box-shadow: 0 0 0 2px rgba(8,145,178,0.08);
}

/* Review input */
.report-review-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-sm);
  font-family: inherit;
  color: var(--text-primary);
  resize: vertical;
  min-height: 50px;
  background: rgba(245,158,11,0.02);
}

.report-review-input:focus {
  outline: none;
  border-color: #D97706;
}

/* KB refs */
.report-kb-ref {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.report-kb-ref-id {
  padding: 1px 6px;
  background: rgba(59,130,246,0.08);
  color: #2563EB;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
}

/* ==========================================================================
   Disclaimer
   ========================================================================== */

#page-report .report-disclaimer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: rgba(8,145,178,0.05);
  border-top: 1px solid rgba(8,145,178,0.12);
  font-size: 10.5px;
  color: #0E7490;
  flex-shrink: 0;
  z-index: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#page-report .report-disclaimer svg { flex-shrink: 0; color: #0891B2; }

/* ==========================================================================
   Toast
   ========================================================================== */

.report-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 22px;
  background: #1E293B;
  color: #fff;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  pointer-events: none;
  white-space: nowrap;
  animation: reportToastIn 0.3s ease;
}

@keyframes reportToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
  body * { visibility: hidden; }
  #page-report, #page-report * { visibility: visible; }
  #page-report {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    overflow: visible;
  }
  #page-report .report-stats-row,
  #page-report .report-sidebar,
  #page-report .report-action-bar,
  #page-report .report-btn-area,
  #page-report .report-filter-row,
  #page-report .report-sidebar-header,
  #page-report .report-disclaimer { display: none !important; }
  #page-report .report-body { display: block; }
  #page-report .report-content { overflow: visible; padding: 0; }
  #page-report .report-edit-title,
  #page-report .report-edit-textarea,
  #page-report .report-review-input { border: none; background: transparent; resize: none; }
  #page-report .report-view-title { font-size: 16px; }
  #page-report .report-section-body { font-size: 11px; }
  @page { margin: 15mm; size: A4; }
}

/* ==========================================================================
   Animations
   ========================================================================== */

.report-fade-in { animation: reportFadeIn 0.3s ease; }

@keyframes reportFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .report-fade-in, .report-toast { animation: none; }
}
