/* ============================================
   布局样式 - 容器、头部、侧边栏、内容区
   ============================================ */

/* 主容器 */
.container {
  display: flex;
  height: 100vh;
  flex-direction: column;
}

/* 头部 */
.header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header h1 {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
}

.folder-select {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  min-width: 200px;
  cursor: pointer;
  background: white;
}

/* 主区域 */
.main-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  width: 300px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 12px;
}

.sidebar-header {
  padding: 15px;
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header .stats {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 内容区 */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 12px 12px 12px 0;
}

/* 摘要信息区域 */
.summary-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-lighter);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.summary-item label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.summary-full {
  grid-column: span 4;
}

.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* 预览区域 */
.preview-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

/* 预览区面板容器 */
.preview-panels {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

/* 面板 */
.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background: var(--bg-lighter);
}

.panel-content {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

/* 面板分隔条（拖拽调宽） */
.panel-divider {
  flex: 0 0 6px;
  margin: 0 -3px; /* 吃掉部分 gap，让热区居中在间隙上 */
  cursor: col-resize;
  border-radius: 3px;
  transition: background 0.15s;
  z-index: 5;
}

.panel-divider:hover,
.panel-divider.dragging {
  background: var(--primary, #1976d2);
}

/* 面板最大化按钮 */
.panel-max-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  color: #666;
  border-radius: 4px;
}

.panel-max-btn:hover {
  background: #e0e0e0;
  color: #333;
}

/* OCR 面板头部已有 margin-left:auto 的按钮时，最大化按钮不再抢 auto */
.panel-header .btn + .panel-max-btn {
  margin-left: 4px;
}

/* 面板最大化（fixed 脱离 flex 布局） */
.panel-maximized {
  position: fixed;
  inset: 0;
  z-index: 1200;
  border-radius: 0;
  background: #fff;
}

body.panel-maximized-open {
  overflow: hidden;
}

/* 响应式布局 */
@media (max-width: 768px) {
  .panel-divider {
    display: none;
  }

  .main-area {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: 300px;
    margin: 8px;
  }
  
  .content {
    margin: 8px;
  }
  
  .preview-section {
    flex-direction: column;
  }
  
  .panel {
    min-height: 200px;
  }
  
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .summary-full {
    grid-column: span 2;
  }
}