/* =============================================
   报告管理页面样式
   ============================================= */

/* ---- 筛选栏 ---- */
.rpt-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* 搜索框 */
.rpt-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
  min-width: 180px;
}

.rpt-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.rpt-search-input {
  width: 100%;
  height: 38px;
  padding: 0 90px 0 38px;
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: var(--radius-btn);
  color: var(--text-body);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rpt-search-input::placeholder { color: var(--text-muted); }

.rpt-search-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* 搜索框内右侧：清空 + 搜索按钮 */
.rpt-search-clear {
  position: absolute;
  right: 100px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(51, 65, 85, 0.6);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.rpt-search-clear:hover {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.rpt-search-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 16px;
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  background: var(--accent-emerald);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.rpt-search-btn:hover {
  background: #0ea572;
}

/* 类型筛选按钮组 */
.rpt-type-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rpt-type-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.5);
  background: var(--bg-card);
  color: var(--text-body);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.rpt-type-btn:hover {
  border-color: rgba(51, 65, 85, 0.8);
  color: var(--text-title);
}

.rpt-type-btn--active {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.rpt-type-btn--active:hover {
  background: #0ea572;
  border-color: #0ea572;
  color: #fff;
}

/* 时间范围筛选按钮 */
.rpt-date-filter-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.5);
  background: var(--bg-card);
  color: var(--text-body);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.rpt-date-filter-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.rpt-date-filter-btn.is-active {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

/* ---- 时间范围面板 ---- */
.rpt-date-panel {
  display: none;
  margin-bottom: 20px;
}

.rpt-date-panel.is-open {
  display: block;
}

.rpt-date-panel-inner {
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rpt-date-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.rpt-date-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rpt-date-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.rpt-date-input {
  height: 38px;
  padding: 0 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: var(--radius-btn);
  color: var(--text-body);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 160px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color-scheme: dark;
}

.rpt-date-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.rpt-date-sep {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding-bottom: 8px;
  flex-shrink: 0;
}

/* 快捷选项 */
.rpt-date-shortcuts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rpt-date-shortcut {
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-tag);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.4);
  background: var(--bg-elevated);
  color: var(--text-body);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.rpt-date-shortcut:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.06);
}

/* 面板底部操作 */
.rpt-date-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(51, 65, 85, 0.25);
}

.rpt-date-reset {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(51, 65, 85, 0.5);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.rpt-date-reset:hover {
  border-color: rgba(51, 65, 85, 0.8);
  color: var(--text-body);
}

.rpt-date-confirm {
  height: 34px;
  padding: 0 20px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: var(--accent-emerald);
  color: #fff;
  transition: background 0.15s ease;
}

.rpt-date-confirm:hover {
  background: #0ea572;
}

/* ---- 通用图标按钮 ---- */
.rpt-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.5);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-family: inherit;
}

.rpt-icon-btn:hover {
  background: var(--bg-elevated);
  border-color: rgba(51, 65, 85, 0.8);
  color: var(--text-title);
}

/* ---- 卡片网格 ---- */
.rpt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .rpt-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* ---- 单张卡片 ---- */
.rpt-card {
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.3);
  border-radius: var(--radius-card);
  padding: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rpt-card:hover {
  border-color: rgba(51, 65, 85, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

/* 卡片顶部：图标 + 状态 */
.rpt-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.rpt-card-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
  flex-shrink: 0;
}

/* 卡片标题 */
.rpt-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 类型徽章行 */
.rpt-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

/* 类型徽章 */
.rpt-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-tag);
  font-size: 11px;
  font-weight: 500;
}

.rpt-badge--weekly     { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.rpt-badge--monthly    { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.rpt-badge--quarterly  { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.rpt-badge--semiannual { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.rpt-badge--annual     { background: rgba(239, 68, 68, 0.12);  color: #f87171; }

/* 状态标签（右上角） */
.rpt-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.rpt-status--ready { color: #34d399; }

/* 关联任务行 */
.rpt-task-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-tag);
  margin-bottom: 12px;
  color: var(--text-body);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.rpt-task-link:hover {
  background: rgba(28, 35, 51, 0.8);
}

.rpt-task-link svg:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.rpt-task-link span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rpt-task-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* 时间信息 */
.rpt-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.rpt-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.rpt-meta-item svg { flex-shrink: 0; }

/* 数据指标区 */
.rpt-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(51, 65, 85, 0.25);
}

.rpt-metric-item { text-align: center; }

.rpt-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.rpt-metric-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-title);
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

/* ---- 加载中 ---- */
.rpt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.rpt-loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(51, 65, 85, 0.5);
  border-top-color: var(--accent-emerald);
  border-radius: 50%;
  animation: rpt-spin 0.8s linear infinite;
}

/* ---- 空状态 ---- */
.rpt-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 320px;
  padding: 60px 20px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid rgba(51, 65, 85, 0.3);
  border-radius: var(--radius-card);
  margin-top: 4px;
}

.rpt-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid rgba(51, 65, 85, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin: 0 auto 20px;
}

.rpt-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 8px;
}

.rpt-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

/* ---- PPT 下载链接（rpt-task-link 作为 <a> 时） ---- */
a.rpt-task-link {
  text-decoration: none;
  color: inherit;
}

a.rpt-task-link:hover {
  background: rgba(28, 35, 51, 0.8);
  color: var(--accent-emerald);
}

a.rpt-task-link:hover .rpt-task-arrow {
  color: var(--accent-emerald);
}
