/* ====================== */
/* CVE详情弹窗 - 优化版 */
/* ====================== */

/* 模态框覆盖层 */
.modal {
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 模态框内容容器 */
.modal-content {
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color);
}

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

/* 模态框头部 */
.modal-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 2px solid var(--primary-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary-color);
}

.modal-header h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 24px;
  background: var(--primary-color);
  border-radius: 2px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--danger-color);
  color: white;
  transform: rotate(90deg);
}

/* CVE详情主体 */
.cve-details {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 详情区块 */
.details-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.details-section:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* 区块标题 */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.section-title i {
  color: var(--primary-color);
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.section-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.section-title .expand-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.section-title .expand-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-color);
}

.section-title .expand-btn i {
  transition: transform 0.3s;
  width: auto;
}

/* 信息网格 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* CVE ID 链接 */
.cve-id-link {
  font-family: var(--font-mono);
  color: var(--primary-color);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--primary-color);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  transition: all 0.2s;
}

.cve-id-link:hover {
  background: var(--primary-color);
  color: white;
}

/* 复制按钮 */
.copy-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
}

/* 分类徽章 */
.category-badge {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid currentColor;
}

.category-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 严重程度徽章 */
.severity-badge {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.severity-badge::before {
  content: '⬤';
  font-size: 10px;
}

.severity-critical {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.severity-high {
  background: rgba(234, 88, 12, 0.1);
  color: #EA580C;
  border: 1px solid rgba(234, 88, 12, 0.3);
}

.severity-medium {
  background: rgba(234, 179, 8, 0.1);
  color: #EAB308;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.severity-low {
  background: rgba(34, 197, 94, 0.1);
  color: #22C55E;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.severity-unknown {
  background: rgba(107, 114, 128, 0.1);
  color: #6B7280;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* 摘要内容 */
.summary-content {
  line-height: 1.8;
  color: var(--text-primary);
}

.summary-content p {
  margin: 0 0 12px 0;
}

.summary-content p:last-child {
  margin-bottom: 0;
}

/* 关键点列表 */
.key-points-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-points-list li {
  position: relative;
  padding-left: 28px;
  line-height: 1.6;
  color: var(--text-primary);
}

.key-points-list li::before {
  content: '▸';
  position: absolute;
  left: 8px;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 16px;
}

/* 可展开内容 */
.expandable-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.expandable-content.collapsed {
  max-height: 0;
}

/* 技术细节 */
.technical-details {
  line-height: 1.8;
  color: var(--text-primary);
}

.technical-details p {
  margin: 0 0 12px 0;
  text-indent: 2em;
}

.technical-details p:last-child {
  margin-bottom: 0;
}

/* 原始数据项 */
.original-data-item {
  margin-bottom: 20px;
}

.original-data-item:last-child {
  margin-bottom: 0;
}

.original-data-item h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.original-data-item h4 i {
  color: var(--primary-color);
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* CVSS信息 */
.cvss-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* 配置信息 */
.configurations {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* 参考链接 */
.references {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reference-item {
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  border-left: 3px solid var(--primary-color);
  font-size: 13px;
}

.reference-item a {
  color: var(--primary-color);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s;
}

.reference-item a:hover {
  text-decoration: underline;
  color: var(--accent-color);
}

.reference-tags {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* 描述信息 */
.descriptions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.description-item {
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.description-item strong {
  display: inline-block;
  min-width: 60px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
}

/* 相关CVE */
.related-cves {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.related-cve-item {
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.related-cve-item:hover {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.related-cve-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.related-cve-id {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-color);
  font-size: 13px;
}

.related-cve-category {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.related-cve-summary {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* 操作按钮区域 */
.details-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.action-btn {
  flex: 1;
  min-width: 150px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.action-btn i {
  font-size: 16px;
}

.action-btn.primary {
  background: var(--primary-color);
  color: white;
}

.action-btn.primary:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.action-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.action-btn.secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 加载状态 */
.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.loading-spinner {
  text-align: center;
}

.loading-spinner i {
  font-size: 48px;
  color: var(--primary-color);
  margin-bottom: 16px;
}

.loading-spinner p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

/* 错误状态 */
.error-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.error-message {
  text-align: center;
  max-width: 400px;
}

.error-message i {
  font-size: 48px;
  color: var(--warning-color);
  margin-bottom: 16px;
}

.error-message h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  color: var(--text-primary);
}

.error-message p {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.retry-btn {
  padding: 10px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.retry-btn:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .modal-body {
    padding: 16px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .related-cves {
    grid-template-columns: 1fr;
  }

  .details-actions {
    flex-direction: column;
  }

  .action-btn {
    min-width: auto;
  }
}

/* 暗色主题适配 */
[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .details-section:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .reference-item {
  border-left-color: var(--accent-color);
}

[data-theme="dark"] .related-cve-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* 平滑滚动 */
.modal-content {
  scroll-behavior: smooth;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}
