/* ========== 全局A4标准定义 ========== */
:root {
  --a4-width: 210mm;
  --a4-height: 297mm;
  --page-padding: 15mm; /* 页面内边距 */
}

/* 报告外层容器 */
#survey-major-report-generate-result {
  width: 100%;
  padding: 20px 0;
}

/* 报告包裹层 */
.mmr-report-wrapper {
  width: var(--a4-width);
  margin: 0 auto;
}

/* ========== 核心：A4页面样式 ========== */
.a4-page {
  width: var(--a4-width);
  height: var(--a4-height);
  padding: var(--page-padding);
  background: #eeeeee52;
  position: relative;
  overflow: hidden; /* 禁止内容溢出 */
  box-sizing: border-box;
  page-break-after: always; /* 打印分页 */
  margin-bottom: 20px; /* 网页预览间隔 */
}

/* 最后一页取消分页间隔 */
.a4-page:last-child {
  page-break-after: avoid;
}

/* 页码 */
.page-number {
  position: absolute;
  bottom: 10mm;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #666;
}

/* ========== 封面样式 ========== */
.mmr-report-cover {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative; 
  page-break-after: always;
}

.mmr-cover-logo {
  position: absolute;
  top: 20mm;
  left: 20mm;
  width: 80px !important;
  height: 80px !important;
  object-fit: contain !important;
  z-index: 10;
}

.mmr-cover-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.mmr-report-title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #333;
}

.mmr-report-subtitle {
  font-size: 18px;
  color: #666;
  margin-bottom: 60px;
}

.mmr-report-info {
  font-size: 14px;
  color: #888;
  line-height: 2.2;
}

/* ========== 通用内容样式 ========== */
.mmr-section-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #1890ff;
  padding-bottom: 10px;
}

.mmr-section-paragraph {
  font-size: 16px;
  line-height: 1.8;
  color: #444;
  text-align: justify;
  margin-bottom: 20px;
}

/* 分割线样式（统一报告风格） */
.mmr-divider {
  border-color: #e8e8e8;
  margin: 16px 0;
  font-weight: bold;
}

/* ========== 目录样式 ========== */
.mmr-toc-list {
  list-style: none;
  padding: 0;
  margin-top: 30px;
}

.mmr-toc-item {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  margin-bottom: 12px;
  color: #333;
}

/* ========== 统计卡片样式 ========== */
.mmr-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 25px;
}

.mmr-stat-item {
  flex: 1;
  min-width: 180px;
  padding: 15px;
  background: #f5f7fa;
  border-radius: 6px;
  text-align: center;
}

.mmr-stat-value {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
}

/* ========== 表格适配 ========== */
.ant-table {
  font-size: 14px !important;
}

/* ========== 流程图样式（无任何边框） ========== */
.mmr-flow-img-container {
  width: 100%;
  text-align: center;
  margin-top: 20px;
}

.mmr-flow-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ========== 占位符 ========== */
.mmr-report-placeholder {
  width: var(--a4-width);
  height: 400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 8px;
}

/* 流程图居中，无任何边框 */
.mmr-flow-img-container {
  width: 100%;
  text-align: center;
  margin: 20px 0 10px;
}
.mmr-flow-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.mmr-subsection-title {
  font-weight: 600;
}

/* ========== 政策导向分析报告样式 ========== */
.mmr-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 25px 0 30px;
}

.mmr-stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mmr-stat-card:hover {
  transform: translateY(-5px);
}

.mmr-stat-card:nth-child(2) {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.mmr-stat-card:nth-child(3) {
  background: linear-gradient(135deg, #4facfe 0%, #2196F3 100%);
}

.mmr-stat-card:nth-child(4) {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.mmr-stat-value {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
}

.mmr-stat-label {
  font-size: 14px;
  opacity: 0.95;
}

.mmr-classification-distribution {
  margin: 25px 0;
}

.mmr-classification-item {
  margin-bottom: 15px;
}

.mmr-classification-bar {
  height: 30px;
  background: #e8f4ff;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.mmr-classification-fill {
  height: 100%;
  background-color: #6991dc;
  border-radius: 15px;
  transition: width 1s ease;
}

.mmr-important-fill {
  background-color: #a0cfff;
}


.mmr-limit-fill {
  background-color: #c0c6cc;
}

.mmr-classification-label {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
}

.mmr-classification-count {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #1a5fb4;
  font-weight: 600;
  font-size: 14px;
}

.mmr-chart-container {
  margin: 30px 0;
  padding: 20px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}

.mmr-chart-title {
  text-align: center;
  margin-bottom: 15px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 16px;
}

.mmr-region-analysis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 25px;
}

.mmr-region-card {
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 20px;
  background: #fafbfc;
  transition: all 0.3s ease;
}

.mmr-region-card:hover {
  border-color: #2e86de;
  box-shadow: 0 4px 12px rgba(46, 134, 222, 0.15);
}

.mmr-region-name {
  font-size: 16px;
  font-weight: bold;
  color: #1a5fb4;
  margin-bottom: 10px;
}

.mmr-region-industry {
  color: #666;
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.mmr-key-professions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mmr-profession-tag {
  background: #e8f4ff;
  color: #1a5fb4;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid #d0e3ff;
}

.mmr-data-table-container {
  overflow-x: auto;
  margin-top: 20px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}

.mmr-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mmr-data-table th,
.mmr-data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
}

.mmr-data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #1a5fb4;
  position: sticky;
  top: 0;
}

.mmr-data-table tr:hover {
  background-color: #f8fbff;
}

.mmr-summary-text {
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}

.mmr-summary-text p {
  margin-bottom: 15px;
  text-align: justify;
}

.mmr-summary-text strong {
  color: #1a5fb4;
}

/* 表格样式增强 */
.mmr-data-table th:nth-child(1) {
  width: 40%;
}

.mmr-data-table th:nth-child(2) {
  width: 15%;
  text-align: center;
}

.mmr-data-table th:nth-child(3) {
  width: 35%;
}

.mmr-data-table th:nth-child(4) {
  width: 10%;
  text-align: center;
}

.mmr-data-table td:nth-child(2),
.mmr-data-table td:nth-child(4) {
  text-align: center;
}

.mmr-data-table td:nth-child(3) {
  padding-left: 20px;
  padding-right: 20px;
}

.mmr-list-type-important {
  background-color: #e8f4ff;
  color: #1a5fb4;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.mmr-list-type-reform {
  background-color: #f8f0ff;
  color: #764ba2;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.mmr-list-type-limit {
  background-color: #ffe8e8;
  color: #f5576c;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.mmr-score-bar {
  width: 100%;
  height: 20px;
  border-radius: 10px;
  position: relative;
  overflow: visible;
  background: #d9d9d9;
}

.mmr-score-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
  min-width: 2px;
}

.mmr-score-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateY(-50%);
  color: #262626;
  font-weight: 600;
  white-space: nowrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .mmr-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .mmr-region-analysis {
    grid-template-columns: 1fr;
  }
  
  .mmr-data-table th,
  .mmr-data-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  .mmr-list-type-important,
  .mmr-list-type-reform,
  .mmr-list-type-limit {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .mmr-score-bar {
    height: 16px;
  }
  
  .mmr-score-text {
    font-size: 10px;
  }
}

/* 专业质量分析 */
.two-column-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 25px 0;
}

.indicator-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.indicator-item {
  background: #f8faff;
  padding: 15px;
  border-radius: 8px;
  border-left: 3px solid #2e8bcc;
}

.indicator-name {
  font-weight: 600;
  color: #1a5fb4;
  margin-bottom: 5px;
}

.indicator-desc {
  font-size: 0.9rem;
  color: #666;
}

.score-high {
  color: #2ecc71;
  font-weight: bold;
}

.score-medium {
  color: #f39c12;
  font-weight: bold;
}

.score-low {
  color: #e74c3c;
  font-weight: bold;
}

.top10-row {
  background-color: #f0f9ff;
}

/* 评价指标表格样式 */
.indicator-first-secondary-row {
  background-color: #f8fbff !important;
  border-top: 2px solid #e8f4ff !important;
}

.indicator-second-level-row {
  background-color: #ffffff !important;
}

.indicator-second-level-row:hover {
  background-color: #f5f9ff !important;
}

@media (max-width: 768px) {
  .two-column-grid {
    grid-template-columns: 1fr;
  }
  
  .indicator-list {
    grid-template-columns: 1fr;
  }
}

/* 优化评价指标表格：合并单元格垂直居中 */
.mmr-data-table .ant-table-cell {
  vertical-align: middle !important;
  text-align: center !important;
}
/* 移除原有多余表格样式，统一正式风格 */
.indicator-first-secondary-row,
.indicator-second-level-row {
  background: #fff !important;
}
/* 表格表头样式 */
.mmr-data-table .ant-table-thead > tr > th {
  background: #f5f7fa !important;
  font-weight: bold !important;
  border-color: #e8e8e8 !important;
}

.report-status-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: #fff;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  min-width: 260px;
}

.status-title {
  font-size: 14px;
  font-weight: bold;
  color: #1a5fb4;
  margin-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 6px;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 0;
}

.status-item {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.status-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.status-icon.pending { background: #999; }
.status-icon.loading { 
  background: #1890ff; 
  animation: pulse 1s infinite ease-in-out; 
}
.status-icon.success { background: #52c41a; }
.status-icon.error { background: #ff4d4f; }

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* ========== 编辑模式样式 ========== */
/* 编辑态：整个报告包裹层 */
.mmr-report-wrapper.editing {
  border: 2px dashed #faad14;
  border-radius: 4px;
  padding: 4px;
  cursor: text;
  min-height: 200px;
}

/* 编辑态：每个A4页面加虚线边框 */
.mmr-report-wrapper.editing .a4-page {
  border: 1px dashed #d9d9d9;
  transition: border-color 0.2s;
}

.mmr-report-wrapper.editing .a4-page:hover {
  border-color: #faad14;
  background-color: #fffbe6;
}

/* 编辑态：文本段落悬停高亮 */
.mmr-report-wrapper.editing .mmr-section-paragraph:hover,
.mmr-report-wrapper.editing .mmr-section-title:hover,
.mmr-report-wrapper.editing .mmr-subsection-title:hover,
.mmr-report-wrapper.editing .mmr-report-title:hover,
.mmr-report-wrapper.editing .mmr-report-subtitle:hover,
.mmr-report-wrapper.editing .mmr-report-info:hover {
  background-color: #fff7e6;
  outline: 1px dashed #faad14;
  outline-offset: 2px;
  cursor: text;
}

/* 编辑态：获得焦点的元素 */
.mmr-report-wrapper.editing [contenteditable]:focus {
  outline: 2px solid #1890ff;
  outline-offset: 2px;
}

/* 编辑态：表格容器不可编辑（保护表格结构） */
.mmr-report-wrapper.editing .mmr-data-table-container {
  cursor: default;
  opacity: 0.95;
}

.mmr-report-wrapper.editing .mmr-data-table-container:hover {
  background-color: #fffbe6;
  border-color: #faad14;
}

/* 编辑态：页码不可编辑 */
.mmr-report-wrapper.editing .page-number {
  cursor: default;
  user-select: none;
}

/* 编辑态：封面Logo保持不可选 */
.mmr-report-wrapper.editing .mmr-cover-logo {
  user-select: none;
  pointer-events: none;
}

/* 编辑态：自定义添加的页面高亮 */
.mmr-report-wrapper.editing .mmr-report-custom {
  border-left: 3px solid #1890ff;
  padding-left: 10px;
}

/* 编辑态：工具栏按钮增强 */
.root-toolbar .toolbar-item.editing-active {
  background-color: #fff7e6;
  border-color: #faad14;
}
