/* 文档详情页面优化样式 */
.doc-content-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  background-color: var(--bg-light);
  border-radius: 12px;
  background-color: white;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.doc-content-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: white;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.doc-content-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  background-color: #fbfbfc;
}

/* 改进文档内容区域 */
.document-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  line-height: 1.7;
  background-color: white;
  border-radius: 0;
  box-shadow: var(--shadow-sm);
  margin: 16px;
}

/* 文档标题样式 */
.document-title {
  font-size: 32px;
  font-weight: 800;
  /* Fallback color for browsers that don't support background-clip */
  color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color) 0%, #667eea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 24px 0 32px 0;
  padding-bottom: 20px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--primary-color), rgba(67, 97, 238, 0.3), transparent) 1;
  line-height: 1.2;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
  width: 100%;
  word-wrap: break-word;
  word-break: break-word;
}

.document-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), #667eea);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

/* 鼠标悬停效果 */
.document-title:hover::after {
  width: 120px;
  transition: width 0.3s ease;
}

/* 自适应图片尺寸 */
.document-content img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

/* 改进文档元数据区域 */
.document-metadata {
  width: 300px;
  padding: 24px;
  border-left: 1px solid var(--border-color);
  background-color: white;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  margin: 16px 16px 16px 0;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.metadata-section {
  margin-bottom: 24px;
}

.metadata-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.doc-meta-item {
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.doc-meta-item:hover {
  background-color: #f5f7ff;
}

.doc-meta-item i {
  color: var(--primary-color);
  margin-top: 2px;
  font-size: 16px;
}

/* 文件操作按钮改进 */
.file-action-buttons {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
  background-color: #3850d0;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
  background-color: white;
  color: var(--text-secondary);
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background-color: #f5f7ff;
  color: var(--primary-color);
  border-color: rgba(67, 97, 238, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(67, 97, 238, 0.15);
}

/* 文档内容格式优化 */
.doc-text-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-color);
}

.doc-text-content h1, 
.doc-text-content h2, 
.doc-text-content h3, 
.doc-text-content h4, 
.doc-text-content h5, 
.doc-text-content h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-color);
}

.doc-text-content h1 {
  font-size: 1.75em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-top: 32px;
}

.doc-text-content h2 {
  font-size: 1.5em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-top: 28px;
}

.doc-text-content p,
.doc-text-content ul,
.doc-text-content ol {
  margin-bottom: 16px;
}

.doc-text-content code {
  background-color: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  font-size: 0.9em;
}

.doc-text-content pre {
  background-color: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

.doc-text-content pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

.doc-text-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 16px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 16px 0;
}

.doc-text-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.doc-text-content table th,
.doc-text-content table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.doc-text-content table th {
  background-color: #f8fafc;
  font-weight: 600;
}

.doc-text-content table tr:nth-child(even) {
  background-color: #f9fafb;
}

/* 文档操作按钮样式优化 */
.doc-actions {
  display: flex;
  gap: 12px;
}

.edit-doc-btn, .delete-doc-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.edit-doc-btn {
  color: var(--primary-color);
  border: 1px solid rgba(67, 97, 238, 0.3);
  background-color: rgba(67, 97, 238, 0.03);
}

.delete-doc-btn {
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.03);
}

.edit-doc-btn:hover {
  background-color: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
  border-color: rgba(67, 97, 238, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(67, 97, 238, 0.15);
}

.delete-doc-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.15);
}

/* 响应式设计优化 */
@media (max-width: 1024px) {
  .doc-content-main {
    flex-direction: column;
  }
  
  .document-metadata {
    width: auto;
    margin: 0 16px 16px 16px;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 768px) {
  .document-content,
  .document-metadata {
    padding: 16px;
    margin: 12px;
  }
  
  .doc-content-header {
    padding: 16px;
  }
  
  .edit-doc-btn, .delete-doc-btn {
    padding: 8px 12px;
  }
  
  .edit-doc-btn span, .delete-doc-btn span {
    display: none;
  }
  
  .doc-actions {
    gap: 8px;
  }
  
  .document-title {
    font-size: 28px;
    margin: 20px 0 24px 0;
    padding-bottom: 16px;
  }
  
  .document-title::after {
    width: 50px;
    height: 3px;
  }
  
  .document-title:hover::after {
    width: 80px;
  }
}

@media (max-width: 480px) {
  .document-title {
    font-size: 24px;
    margin: 16px 0 20px 0;
    padding-bottom: 12px;
  }
  
  .document-title::after {
    width: 40px;
  }
  
  .document-title:hover::after {
    width: 60px;
  }
}

/* 图片预览优化 */
.image-preview {
  margin-bottom: 32px;
  text-align: center;
  background-color: #f8fafc;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.image-preview img {
  max-width: 100%;
  max-height: 500px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s;
  cursor: zoom-in;
}

.image-preview img:hover {
  transform: scale(1.01);
}

/* 加载状态指示器优化 */
.doc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.doc-loading-spinner {
  border: 4px solid rgba(67, 97, 238, 0.1);
  border-radius: 50%;
  border-top: 4px solid var(--primary-color);
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

.doc-loading-text {
  font-size: 14px;
  font-weight: 500;
}

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

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* 图片预览模态窗口 */
.image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 40px;
}

.image-preview-modal.show {
  opacity: 1;
}

.image-preview-modal img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  object-fit: contain;
}

.close-preview-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.close-preview-modal:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* 文档操作按钮样式 */
.doc-meta-item.action-item {
  cursor: pointer;
}

.doc-meta-item.action-item a {
  color: var(--text-secondary);
  text-decoration: none;
  flex: 1;
}

.doc-meta-item.action-item:hover a {
  color: var(--primary-color);
}

/* 目录导航样式 */
.toc-list {
  margin-top: 12px;
}

.toc-item {
  margin-bottom: 8px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.toc-link:hover {
  background-color: rgba(67, 97, 238, 0.08);
  color: var(--primary-color);
}

.toc-link i {
  font-size: 16px;
  color: var(--primary-color);
}

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

/* 分享模态窗口样式 */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.share-modal.show {
  opacity: 1;
}

.share-modal-content {
  background-color: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease forwards;
}

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

.share-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.close-share-modal {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.2s;
}

.close-share-modal:hover {
  background-color: #f1f5f9;
  color: var(--text-color);
}

.share-modal-body {
  padding: 20px;
}

.share-url-container {
  display: flex;
  margin-bottom: 20px;
  position: relative;
}

.share-url-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background-color: #f8fafc;
  color: var(--text-color);
}

.copy-share-url {
  position: absolute;
  right: 4px;
  top: 4px;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-share-url:hover {
  background-color: #f5f7ff;
  color: var(--primary-color);
}

.copy-share-url.copied {
  background-color: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.share-option {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.share-option i {
  font-size: 24px;
  color: var(--primary-color);
}

.share-option:hover {
  background-color: #f5f7ff;
  border-color: rgba(67, 97, 238, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(67, 97, 238, 0.1);
}

/* 操作通知样式 */
.action-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.action-notification.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .share-options {
    grid-template-columns: 1fr;
  }
  
  .share-modal-content {
    width: 95%;
  }
  
  .action-notification {
    left: 20px;
    right: 20px;
    text-align: center;
  }
}

/* 确保文档内容区域正常显示 */
#doc-content-section {
    display: none;
    width: 100%;
    height: 100%;
    overflow: auto;
}

#doc-content-section.active {
    display: block;
} 