/* ==========================================================================
   styles.css - 演示页基础样式
   不引外部框架,够用就好
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.5;
}

code {
  font-family: "Consolas", "Monaco", monospace;
  background: #eef1f5;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ---------- Header ---------- */
header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 24px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
header h1 {
  margin: 0 0 4px 0;
  font-size: 22px;
}
header .sub {
  opacity: 0.8;
  font-size: 13px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 0 0;
  border-bottom: 2px solid #e0e6ed;
}
.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #7f8c8d;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab:hover {
  color: #2c3e50;
  background: #f8f9fa;
}
.tab.active {
  color: #3498db;
  border-bottom-color: #3498db;
  background: #fff;
}

/* ---------- Tab Panel ---------- */
.tab-panel {
  display: none;
  background: white;
  padding: 24px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.tab-panel.active {
  display: block;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef1f5;
}
.panel-title {
  font-size: 16px;
  font-weight: 600;
}
.panel-title .count {
  display: inline-block;
  background: #3498db;
  color: white;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  margin-left: 8px;
}
.panel-actions {
  display: flex;
  gap: 8px;
}

/* ---------- Buttons ---------- */
.btn {
  padding: 8px 16px;
  border: 1px solid #d0d7de;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #2c3e50;
  transition: all 0.15s;
}
.btn:hover {
  background: #f6f8fa;
  border-color: #b0b9c2;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-primary {
  background: #3498db;
  border-color: #3498db;
  color: white;
}
.btn-primary:hover {
  background: #2980b9;
  border-color: #2980b9;
}
.btn-danger {
  background: #e74c3c;
  border-color: #e74c3c;
  color: white;
}
.btn-danger:hover {
  background: #c0392b;
  border-color: #c0392b;
}
.btn-warning {
  background: #f39c12;
  border-color: #f39c12;
  color: white;
}
.btn-warning:hover {
  background: #d68910;
}

/* ---------- File input 包装(原生 input 很丑) ---------- */
.file-input-wrap {
  position: relative;
  display: inline-block;
}
.file-input-wrap input[type="file"] {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

/* ---------- Progress ---------- */
.progress {
  font-size: 12px;
  margin-left: 12px;
  color: #7f8c8d;
}
.progress.active { color: #3498db; }
.progress.success { color: #27ae60; }
.progress.error { color: #e74c3c; }

/* ---------- Attachment List ---------- */
.att-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.att-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fafbfc;
  border: 1px solid #eef1f5;
  border-radius: 6px;
  transition: background 0.15s;
}
.att-row:hover {
  background: #f0f4f8;
  border-color: #d0d7de;
}
.att-icon {
  font-size: 28px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.att-info {
  flex: 1;
  min-width: 0;
}
.att-name {
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: #7f8c8d;
}
.att-stored { font-family: "Consolas", monospace; }
.att-path {
  font-family: "Consolas", monospace;
  font-size: 11px;
  color: #95a5a6;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: #95a5a6;
  background: #fafbfc;
  border: 1px dashed #d0d7de;
  border-radius: 6px;
}

/* ---------- Delete entity 按钮(突出 v1 bug 修复) ---------- */
.delete-entity-section {
  margin-top: 24px;
  padding: 16px;
  background: #fef9e7;
  border: 1px solid #f39c12;
  border-radius: 6px;
}
.delete-entity-section h4 {
  margin: 0 0 8px 0;
  color: #d68910;
  font-size: 14px;
}
.delete-entity-section p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #7f8c8d;
}

/* ---------- Debug Panel ---------- */
.debug-panel {
  background: white;
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.debug-title {
  font-size: 16px;
  font-weight: 600;
}
.debug-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #f0f4f8;
  border-radius: 6px;
}
.debug-stat {
  display: flex;
  flex-direction: column;
}
.debug-stat-label {
  font-size: 11px;
  color: #7f8c8d;
  text-transform: uppercase;
}
.debug-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-top: 2px;
}
.debug-stat-list {
  margin: 4px 0 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: #7f8c8d;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.debug-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f0f4f8;
  font-weight: 600;
  color: #7f8c8d;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 2px solid #d0d7de;
}
.debug-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f5;
  color: #2c3e50;
}
.debug-table tr:hover {
  background: #fafbfc;
}
.debug-table code {
  font-size: 11px;
}

/* ---------- Preview Modal ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
}
.modal-box {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eef1f5;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
  padding: 0;
  line-height: 1;
}
.modal-body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}

/* ---------- Preview 内容样式 ---------- */
.preview-image {
  text-align: center;
}
.preview-text, .preview-eml-body {
  background: #fafbfc;
  padding: 16px;
  border-radius: 6px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
}
.preview-excel { overflow: auto; }
.preview-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}
.preview-table th, .preview-table td {
  border: 1px solid #d0d7de;
  padding: 4px 8px;
  text-align: left;
}
.preview-table th {
  background: #f0f4f8;
  font-weight: 600;
}
.preview-note, .preview-warn {
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 12px;
}
.preview-note {
  background: #e8f4fd;
  color: #2980b9;
}
.preview-warn {
  background: #fef9e7;
  color: #d68910;
}
.preview-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.preview-pdf-page {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  max-width: 100%;
  height: auto;
}
.preview-pdf-label {
  font-size: 12px;
  color: #7f8c8d;
}
.preview-eml-meta {
  background: #f0f4f8;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.8;
}
.preview-eml-meta strong {
  display: inline-block;
  width: 70px;
  color: #7f8c8d;
}
.preview-docx {
  font-size: 14px;
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto;
}
.preview-docx h1, .preview-docx h2, .preview-docx h3 {
  color: #2c3e50;
}
.preview-docx p {
  margin: 0 0 12px 0;
}
.preview-download-only {
  text-align: center;
  padding: 60px 20px;
}
.preview-dl-icon {
  font-size: 60px;
  margin-bottom: 16px;
}
.preview-dl-name {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
  word-break: break-all;
}
.preview-dl-hint {
  color: #7f8c8d;
  font-size: 13px;
  margin-bottom: 4px;
}
.preview-dl-hint-mono {
  font-family: "Consolas", monospace;
  font-size: 11px;
  background: #fef9e7;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  margin: 8px 0;
}
.preview-dl-size {
  color: #95a5a6;
  font-size: 12px;
  margin: 8px 0 20px 0;
}
.preview-dl-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.preview-error {
  background: #fde8e6;
  color: #c0392b;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-size: 13px;
}
.loading {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
}
.error {
  background: #fde8e6;
  color: #c0392b;
  padding: 16px;
  border-radius: 6px;
  text-align: center;
}

/* ---------- Help Box ---------- */
.help-box {
  background: #e8f4fd;
  border-left: 4px solid #3498db;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  border-radius: 0 6px 6px 0;
}
.help-box strong { color: #2980b9; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 24px;
  color: #95a5a6;
  font-size: 12px;
}
footer code {
  background: transparent;
  padding: 0;
}
