/* 模板布局适配：满屏工具页。原 body 的 100vh flex 列布局由模板 .main 承担
 * （.main 为 flex 列容器，.main-container 的 flex:1 继续生效），
 * 全局重置与 body 样式由模板提供 */
.main {
  padding: 18px 22px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== Main Container ===== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ===== Panels ===== */
.panel {
  background: #fff;
  border-right: 1px solid #e6ebf4;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px;
}
.panel-left {
  width: 220px;
}
.panel-right {
  width: 240px;
  border-right: none;
  border-left: 1px solid #e6ebf4;
}
.panel-section {
  margin-bottom: 16px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #1c2433;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #eef4ff;
  position: relative;
}
.panel-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 32px; height: 2px;
  background: linear-gradient(135deg, #2f6bff, #1f56e0);
  border-radius: 2px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid #e6ebf4;
  border-radius: 999px;
  background: #fff;
  color: #5c6678;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  white-space: nowrap;
}
.btn:hover {
  background: #eef4ff;
  border-color: #2f6bff;
  color: #2f6bff;
}
.btn-primary {
  background: linear-gradient(135deg, #2f6bff, #1f56e0);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(47,107,255,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2f6bff, #1f56e0);
  border-color: transparent;
  filter: brightness(1.06);
  box-shadow: 0 6px 16px rgba(47,107,255,.36);
  color: #fff;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}
.btn-full {
  width: 100%;
  margin-top: 4px;
}
.btn-group {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.btn-group .btn {
  flex: 1;
}

/* ===== Canvas ===== */
.canvas-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0f3f9;
  overflow: hidden;
  position: relative;
}
.canvas-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
.canvas-placeholder {
  color: #aaa;
  font-size: 14px;
  text-align: center;
}
#mainCanvas {
  display: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  cursor: crosshair;
}

/* ===== Magnifier ===== */
.magnifier {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  width: 120px;
  height: 120px;
}
.magnifier canvas {
  display: block;
}
.mag-info {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ===== Image List ===== */
.image-list {
  max-height: 300px;
  overflow-y: auto;
}
.image-list-empty {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
}
.image-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e6ebf4;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
}
.image-item:hover {
  background: #f5f8ff;
  border-color: #c9d8ff;
}
.image-item.active {
  background: #eef4ff;
  border-color: #2f6bff;
}
.image-item .thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e6ebf4;
}
.image-item .info {
  flex: 1;
  min-width: 0;
}
.image-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
.image-item .size {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}
.image-item .btn-delete-img {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border: none;
  background: none;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.image-item .btn-delete-img:hover {
  color: #d93025;
  background: #fce8e6;
}

/* ===== Color List ===== */
.color-list {
  max-height: 400px;
  overflow-y: auto;
}
.color-list-empty {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
}
.color-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e6ebf4;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  transition: all .15s;
}
.color-item:hover {
  background: #f5f8ff;
  border-color: #c9d8ff;
}
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}
.color-codes {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.color-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.color-code-val {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  color: #1c2433;
}
.color-code-val.rgb {
  font-size: 10px;
  color: #97a0b3;
}
.color-icon-copy {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #bbb;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.color-icon-copy:hover {
  color: #2f6bff;
  background: #eef4ff;
}
.color-icon-copy.copied {
  color: #16a34a;
  background: #e8f8ee;
}
.color-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border: none;
  background: none;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.color-del:hover {
  color: #d93025;
  background: #fce8e6;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2f6bff, #1f56e0);
  color: #fff;
  padding: 9px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(47,107,255,.35);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.toast.show {
  opacity: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .panel-left { width: 190px; }
  .panel-right { width: 200px; }
}

@media (max-width: 640px) {
  .main-container { flex-direction: column; overflow-y: auto; }
  .panel-left, .panel-right {
    width: 100%;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid #e6ebf4;
  }
  .panel-right { border-top: 1px solid #e6ebf4; border-bottom: none; }
  .image-list { max-height: 160px; }
  .color-list { max-height: 220px; }
  .canvas-container { padding: 10px; min-height: 260px; }
}
