/* assets/css/style.css */
:root {
  --wps-bg: #525659;       /* WPS 风格的深灰主背景 */
  --wps-panel: #2b2b2b;    /* 侧边栏/悬浮工具栏深色 */
  --wps-primary: #3b82f6;  /* 选中时的蓝色 */
  --wps-border: #444;      /* 边框色 */
  --wps-text: #d1d5db;     /* 主文字颜色 */
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
}

body { 
  background: var(--wps-bg); 
  overflow: hidden; 
  height: 100vh; 
  display: flex; 
  flex-direction: column; 
  color: var(--wps-text); 
}

/* 顶部导航栏 */
header { 
  height: 50px; 
  background: var(--wps-panel); 
  border-bottom: 1px solid var(--wps-border); 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 0 20px; 
  flex-shrink: 0;
  z-index: 100;
}

header h1 { 
  font-size: 16px; 
  color: white; 
  font-weight: 500; 
}

.btn { 
  padding: 6px 16px; 
  border-radius: 4px; 
  border: none; 
  cursor: pointer; 
  font-size: 13px; 
  transition: 0.2s; 
  outline: none;
}
.btn-primary { background: var(--wps-primary); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 主体布局 */
main { 
  flex: 1; 
  display: flex; 
  overflow: hidden; 
  position: relative;
}

/* ================= 左侧缩略图侧边栏 ================= */
.sidebar { 
  width: 180px; 
  background: var(--wps-panel); 
  border-right: 1px solid var(--wps-border); 
  overflow-y: auto; 
  padding: 15px; 
  display: flex; 
  flex-direction: column; 
  gap: 15px; 
  flex-shrink: 0;
}

.thumb-card { 
  background: #3a3a3a; 
  border: 2px solid transparent; 
  border-radius: 6px; 
  padding: 6px; 
  cursor: pointer; 
  transition: 0.2s; 
  position: relative; 
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.thumb-card:hover { border-color: #666; }
.thumb-card.active { border-color: var(--wps-primary); }

.thumb-card canvas { 
  width: 100%; 
  height: auto; 
  display: block; 
  background: white; 
  border-radius: 2px;
}

.thumb-badge { 
  position: absolute; 
  bottom: -10px; 
  left: 50%; 
  transform: translateX(-50%); 
  background: #222; 
  color: #ccc;
  padding: 2px 10px; 
  border-radius: 10px; 
  font-size: 11px; 
  border: 1px solid #555;
}

/* ================= 右侧主画布区 ================= */
.main-canvas { 
  flex: 1; 
  overflow: auto; 
  display: flex; 
  justify-content: center; 
  align-items: flex-start; /* 让画布从顶部开始显示 */
  padding: 40px; 
  position: relative; 
  background-color: var(--wps-bg);
}

/* 画布容器 */
.canvas-wrapper { 
  position: relative; 
  background: white; 
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); 
  flex-shrink: 0; /* 核心：防止被 flex 压缩变形 */
  display: block;
  z-index: 5;
  /* 添加过渡效果让切换更平滑 */
  transition: width 0.2s, height 0.2s;
}

#previewCanvas { 
  display: block; 
}

/* 点击捕获层和文字层 */
.click-layer { 
  position: absolute; 
  inset: 0; 
  cursor: text; 
  z-index: 1; 
}

.text-layer { 
  position: absolute; 
  inset: 0; 
  pointer-events: none; /* 穿透鼠标事件，让底层 click-layer 能接收到点击 */
  z-index: 2;
}

/* ================= 悬浮工具栏 ================= */
.float-toolbar { 
  position: absolute; 
  top: 20px; 
  left: 50%; 
  transform: translateX(-50%); 
  background: var(--wps-panel); 
  border: 1px solid var(--wps-border); 
  padding: 8px 16px; 
  border-radius: 8px; 
  display: flex; 
  gap: 20px; 
  align-items: center; 
  z-index: 10; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.4); 
}

.tool-item { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: 13px; 
  color: var(--wps-text);
}

.tool-item input[type="number"] { 
  width: 50px; 
  background: #111; 
  border: 1px solid #555; 
  color: white; 
  padding: 4px 6px; 
  border-radius: 4px; 
  outline: none;
}

.tool-item input[type="color"] { 
  width: 24px; 
  height: 24px; 
  border: none; 
  background: none; 
  cursor: pointer; 
  padding: 0;
}

/* ================= 画布上的文字块 ================= */
.text-item { 
  position: absolute; 
  z-index: 2; 
  cursor: text; 
  white-space: pre-wrap; 
  outline: none; 
  border: 1px solid transparent; 
  pointer-events: auto; 
  line-height: 1.2;
  min-width: 10px;
  min-height: 1em;
  /* 消除双击编辑时的默认蓝色高亮背景 */
  -webkit-tap-highlight-color: transparent; 
}

.text-item:hover { 
  border-color: rgba(59, 130, 246, 0.5); 
  background: rgba(59,130,246,0.05); 
}

.text-item.active { 
  border-color: var(--wps-primary); 
  background: rgba(59,130,246,0.1); 
}

/* 编辑状态的文字框 */
.text-item[contenteditable="true"] { 
  background: white; 
  border: 1px solid var(--wps-primary); 
  min-width: 30px; /* 让空白框有宽度显示光标 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
}

/* 未加载文件时的空状态 */
.empty-state { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  color: #888; 
  height: 100%; 
  width: 100%;
  text-align: center;
  position: absolute;
  top: 0; left: 0;
}
.empty-state h2 {
  font-size: 20px;
  font-weight: normal;
  margin-bottom: 10px;
  color: #aaa;
}