/**
 * PRD 面板样式（login 页面专用）
 * 从 common.css 中提取 PRD 相关样式，避免全局样式污染 login 页面
 */

/* PRD 浮动按钮 */
.prd-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e40af;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.35);
  z-index: 200;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.prd-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(30, 64, 175, 0.45);
  background: #2563eb;
}
.prd-fab.active {
  background: #1e3a8a;
  transform: scale(1.05);
}

/* PRD 遮罩层（分屏模式不需要） */
.prd-overlay { display: none; }

/* PRD 右侧面板（分屏模式） */
.prd-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 0;
  height: 100vh;
  background: #fff;
  z-index: 50;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e2e8f0;
}
.prd-panel.open {
  width: var(--prd-panel-width, 520px);
}
.prd-panel.resizing {
  transition: none;
}

/* 拖拽手柄 */
.prd-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
.prd-resize-handle:hover,
.prd-resize-handle.active {
  background: #1e40af;
  opacity: 0.5;
}
body.prd-resizing {
  cursor: col-resize;
  user-select: none;
}
body.prd-resizing .prd-panel {
  transition: none;
}
body.prd-resizing > .flex {
  transition: none;
}

/* login 页面打开PRD时，主容器左推 */
body.prd-open > .flex {
  margin-right: var(--prd-panel-width, 520px);
  transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
body:not(.prd-open) > .flex {
  transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.prd-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
}
.prd-panel-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.prd-panel-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  background: #1e40af;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.prd-panel-titles { min-width: 0; }
.prd-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prd-panel-subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prd-panel-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: all 0.15s;
}
.prd-panel-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* 搜索栏 */
.prd-search-bar {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
  background: #fafbfc;
}
.prd-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  transition: border-color 0.15s;
}
.prd-search-input-wrap:focus-within {
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.08);
}
.prd-search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: #1e293b;
  background: transparent;
  min-width: 0;
}
.prd-search-input-wrap input::placeholder { color: #cbd5e1; }
.prd-search-clear {
  width: 20px;
  height: 20px;
  border: none;
  background: #f1f5f9;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.1s;
  flex-shrink: 0;
}
.prd-search-clear:hover { background: #fee2e2; color: #dc2626; }
.prd-search-clear.hidden { display: none; }
.prd-search-count {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 36px;
  text-align: center;
}
.prd-search-nav {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.1s;
  flex-shrink: 0;
}
.prd-search-nav:hover { background: #f1f5f9; color: #1e293b; }
.prd-highlight {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.prd-highlight-active {
  background: #f97316;
  color: #fff;
  border-radius: 2px;
  padding: 0 1px;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
}

.prd-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* 加载状态 */
.prd-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 13px;
}
.prd-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e2e8f0;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: prd-spin 0.7s linear infinite;
}
@keyframes prd-spin {
  to { transform: rotate(360deg); }
}

/* 错误状态 */
.prd-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 60px 20px;
  text-align: center;
}
.prd-error-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}
.prd-error-desc {
  font-size: 12px;
  color: #475569;
}

/* Markdown 渲染样式 */
.prd-content.markdown-body {
  font-size: 13px;
  line-height: 1.75;
  color: #1e293b;
  word-wrap: break-word;
}
.prd-content.markdown-body h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #dbeafe;
}
.prd-content.markdown-body h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.prd-content.markdown-body h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 8px;
}
.prd-content.markdown-body h4 {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin: 16px 0 6px;
}
.prd-content.markdown-body p { margin: 0 0 10px; }
.prd-content.markdown-body ul,
.prd-content.markdown-body ol { margin: 0 0 10px; padding-left: 20px; }
.prd-content.markdown-body li { margin-bottom: 4px; }
.prd-content.markdown-body li > ul,
.prd-content.markdown-body li > ol { margin-top: 4px; margin-bottom: 0; }
.prd-content.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.prd-content.markdown-body th {
  background: #f1f5f9;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.prd-content.markdown-body td {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  vertical-align: top;
}
.prd-content.markdown-body tr:nth-child(even) { background: #f8fafc; }
.prd-content.markdown-body code {
  background: #f1f5f9;
  color: #c026d3;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.prd-content.markdown-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
}
.prd-content.markdown-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.prd-content.markdown-body blockquote {
  margin: 10px 0;
  padding: 10px 14px;
  border-left: 3px solid #1e40af;
  background: #eff6ff;
  color: #475569;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
}
.prd-content.markdown-body blockquote p:last-child { margin-bottom: 0; }
.prd-content.markdown-body strong { font-weight: 700; }
.prd-content.markdown-body hr { border: none; border-top: 1px solid #f1f5f9; margin: 20px 0; }
.prd-content.markdown-body a { color: #1e40af; text-decoration: none; }
.prd-content.markdown-body a:hover { text-decoration: underline; }
