/* ============================================================
   PCB点网 EDA - eda.css
   在线EDA编辑器界面样式（延续站点绿色纸感风格）
   ============================================================ */

/* ---------- 布局骨架 ---------- */
.eda-main {
  display: flex;
  flex-direction: column;
  /* 视口高度减去顶部导航(60)与底部状态条(34)，编辑器一屏放满、页面不滚动 */
  height: calc(100vh - 94px);
  min-height: 540px;
}

/* ---------- 顶部工具栏 ---------- */
.eda-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: #fffdf8;
  border-bottom: 1px solid #e3dcc9;
  overflow-x: auto;
  flex: 0 0 auto;
  scrollbar-width: thin;
}
.etabs { display: flex; gap: 4px; flex: 0 0 auto; }
.etabs button {
  border: 1px solid #e3dcc9;
  background: #f7f3e8;
  color: #5a5344;
  padding: 6px 14px;
  border-radius: 8px 8px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.etabs button:hover { color: #14563e; border-color: #b87f3e; }
.etabs button.active {
  background: #14563e;
  border-color: #14563e;
  color: #fff;
}
.etools { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; }
.etools-right { flex: 0 0 auto; }
.etb {
  border: 1px solid transparent;
  background: transparent;
  color: #4a4a3f;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all .12s;
  white-space: nowrap;
}
.etb:hover { background: #efe9d8; color: #14563e; }
.etb.active { background: #14563e; color: #fff; }
.etb:disabled { opacity: .35; cursor: default; }
.etb:disabled:hover { background: transparent; color: #4a4a3f; }
.etb-txt { font-size: 13px; font-weight: 600; }
.etb-sep { width: 1px; height: 22px; background: #e3dcc9; margin: 0 5px; flex: 0 0 auto; }
.etb-layer-top { background: rgba(168, 67, 44, .12); color: #a8432c; }
.etb-layer-bot { background: rgba(43, 111, 142, .14); color: #2b6f8e; }
.etb .etb-txt { font-size: 12.5px; margin-left: 2px; }

/* 画布上方居中工具条（编辑功能按钮区） */
.eda-canvasbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-start;
  background: #fbf9f3;
  border-bottom: 1px solid #e3dcc9;
  padding: 5px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
/* 工具栏超出宽度时：用 auto 外边距居中，溢出后从最左侧开始显示（撤销/重做不会被裁掉） */
.eda-canvasbar .etools {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  margin: 0 auto;
}

/* A4 打印 */
#edaPrintArea { display: none; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; }
  body.eda-printing > *:not(#edaPrintArea) { display: none !important; }
  body.eda-printing #edaPrintArea {
    display: block !important;
    width: auto;
    height: auto;
    overflow: visible;
  }
  /* 每个画布 = 一页 A4 横向；最后一页不追加分页符 */
  #edaPrintArea canvas {
    width: 297mm;
    height: 210mm;
    display: block;
    page-break-after: always;
    break-after: page;
  }
  #edaPrintArea canvas:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  @page { size: A4 landscape; margin: 0; }
}

/* ---------- 编辑器主体 ---------- */
.eda-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: #f4f1ea;
}
.eda-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: #fbf9f3;
  min-height: 0;
}
.eda-lib { width: 232px; border-right: 1px solid #e3dcc9; }
.eda-prop { width: 292px; border-left: 1px solid #e3dcc9; }

.lib-head {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #14563e;
  border-bottom: 1px solid #e9e2d0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.lib-head::after { content: ''; display: none; }

/* 元件库 */
.lib-search-wrap {
  margin: 10px 10px 4px;
  position: relative;
  flex: 0 0 auto;
}
.lib-search-wrap i {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  color: #a89f8a;
  font-size: 13px;
}
.lib-search-wrap input {
  width: 100%;
  border: 1px solid #e3dcc9;
  border-radius: 8px;
  padding: 7px 10px 7px 28px;
  font-size: 13px;
  background: #fff;
  color: #333;
  outline: none;
}
.lib-search-wrap input:focus { border-color: #14563e; }
.lib-list { flex: 1 1 auto; overflow-y: auto; padding: 6px 8px 14px; }
.lib-cat {
  font-size: 11.5px;
  font-weight: 700;
  color: #a89f8a;
  letter-spacing: .05em;
  margin: 12px 4px 5px;
}
.lib-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
}
.lib-item:hover { background: #f1ecdd; border-color: #e3dcc9; }
.lib-item.active { background: rgba(20, 86, 62, .08); border-color: #14563e; }
.lib-item canvas { flex: 0 0 auto; background: #fff; border-radius: 6px; border: 1px solid #eee7d6; }
.lib-item span { font-size: 12.5px; color: #45413a; line-height: 1.3; }
.lib-empty { padding: 20px 10px; text-align: center; color: #a89f8a; font-size: 12.5px; }

/* 画布区 */
.eda-center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
#edaCanvas {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  min-height: 0;
  cursor: default;
  touch-action: none;
}
.eda-minimap {
  position: absolute;
  right: 12px;
  bottom: 36px;
  padding: 3px;
  background: rgba(255, 255, 252, .92);
  border: 1px solid #d8d0bc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(60, 50, 30, .14);
  z-index: 6;
  cursor: crosshair;
}
.eda-minimap canvas { display: block; }
.eda-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 14px;
  background: #14563e;
  color: rgba(255, 255, 255, .88);
  font-size: 12px;
  font-family: Consolas, "Courier New", monospace;
  overflow: hidden;
  white-space: nowrap;
}
.eda-status .st-layer { font-weight: 700; }
.eda-status .st-layer.top { color: #ffb59e; }
.eda-status .st-layer.bot { color: #9fd3ff; }
.eda-status .st-hint {
  margin-left: auto;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: rgba(255, 255, 255, .62);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 属性面板 ---------- */
.prop-scroll { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px 20px; }
.pp-block {
  background: #fff;
  border: 1px solid #e9e2d0;
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin-bottom: 12px;
}
.pp-h {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #14563e;
  margin-bottom: 9px;
}
.pp-h .pp-count { font-size: 11.5px; color: #b87f3e; font-weight: 600; margin-left: 4px; }
.pp-x {
  margin-left: auto;
  border: none;
  background: none;
  color: #a89f8a;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 6px;
}
.pp-x:hover { color: #c0564a; background: #f6efe2; }
.pf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.pf-row label {
  flex: 0 0 52px;
  font-size: 12px;
  color: #6b655a;
  margin: 0;
}
.pf-in {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #e3dcc9;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: #333;
  background: #fbf9f3;
  outline: none;
}
.pf-in:focus { border-color: #14563e; background: #fff; }
select.pf-in { padding: 4px 6px; }
.pf-chk { width: 16px; height: 16px; accent-color: #14563e; }
/* 层管理 */
.ly-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 12.5px;
  color: #45413a;
  border-bottom: 1px dashed #eee7d6;
}
.ly-row:last-of-type { border-bottom: none; }
.ly-sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, .18);
  flex: 0 0 auto;
}
.ly-row span:nth-child(2) { flex: 1 1 auto; }
.ly-row input { margin-left: auto; }
.pp-note {
  font-size: 12px;
  color: #8b8271;
  line-height: 1.55;
  margin: 4px 0;
  word-break: break-all;
}
.pp-note b { color: #b87f3e; }
.pp-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pp-btn {
  border: 1px solid #d8d0ba;
  background: #f7f3e8;
  color: #4a4a3f;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s;
}
.pp-btn:hover { border-color: #14563e; color: #14563e; }
.pp-btn-solid { background: #14563e; border-color: #14563e; color: #fff; }
.pp-btn-solid:hover { background: #0f4530; color: #fff; }

/* 报告列表 */
.rp-item {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid transparent;
}
.rp-item:hover { border-color: #e3dcc9; }
.rp-item i { margin-top: 2px; font-size: 12px; }
.rp-err { color: #a03d32; background: rgba(192, 86, 74, .07); }
.rp-warn { color: #8a6428; background: rgba(184, 127, 62, .09); }
.rp-ok { color: #14563e; background: rgba(20, 86, 62, .06); }

/* ---------- Toast ---------- */
#edaToast {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%) translateY(14px);
  background: #2f3a33;
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 3000;
  max-width: 80vw;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
#edaToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   站点导航 / 页脚（仅本页）：与编辑器工具栏同一套配色、圆角与间距
   —— 导航收窄到 60px、纸感底色 + 铜色细线；页脚做成编辑器风格的深绿状态条
   ============================================================ */
body { padding-top: 60px; }

.site-navbar {
  background: linear-gradient(180deg, #fffdf8 0%, #f8f5ec 100%);
  border-bottom: 1px solid #e3dcc9;
  box-shadow: 0 1px 0 rgba(20, 86, 62, .05), 0 8px 20px -18px rgba(60, 50, 30, .55);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.site-navbar .container { height: 60px; }
.site-navbar .navbar-brand {
  font-size: 16px;
  letter-spacing: .4px;
  color: #14563e;
}
.site-navbar .navbar-brand .brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #ded5bf;
  box-shadow: none;
}
.site-navbar .nav-link {
  font-size: 15px;
  color: #5a5344;
  margin-left: 26px;
  padding: 6px 0;
}
.site-navbar .nav-link::after {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #14563e, #b87f3e);
}
.site-navbar .nav-link.active { color: #14563e; font-weight: 600; }
.site-navbar .nav-link.dropdown-toggle.active { color: #14563e; }
.site-navbar .dropdown-menu {
  background: #fffdf8;
  border: 1px solid #e3dcc9;
  border-radius: 10px;
  box-shadow: 0 14px 34px -18px rgba(60, 50, 30, .5);
}
.site-navbar .dropdown-item { font-size: 14px; color: #4a4a3f; }
.site-navbar .dropdown-item.active,
.site-navbar .dropdown-item:active { background: rgba(20, 86, 62, .1); color: #14563e; }

/* 登录 / 注册：与工具栏按钮同一圆角与高度，注册按钮取编辑器主色 */
.nav-auth { margin-left: 22px; gap: 8px; }
.nav-auth .btn-auth {
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
  transition: all .15s;
}
.nav-auth .btn-auth-login {
  background: #f7f3e8;
  border: 1px solid #e3dcc9;
  color: #5a5344;
}
.nav-auth .btn-auth-login:hover {
  background: #efe9d8;
  border-color: #b87f3e;
  color: #14563e;
}
.nav-auth .btn-auth-register {
  background: #14563e;
  border: 1px solid #14563e;
  color: #fff;
}
.nav-auth .btn-auth-register:hover {
  background: #0f4432;
  border-color: #0f4432;
  color: #fff;
  transform: none;
  box-shadow: 0 6px 16px -10px rgba(20, 86, 62, .9);
}

/* ---------- 站点页脚（编辑器页）：深绿状态条，与画布底部状态栏连成一体 ---------- */
/* 注意：main 与 footer 之间还有 #edaToast，不能用 .eda-main + footer 相邻选择器 */
body > footer {
  border-top: none;
  padding: 0;
  background: linear-gradient(180deg, #14563e 0%, #113f2f 100%);
  color: rgba(255, 255, 255, .72);
}
body > footer .container { width: 100%; max-width: none; padding: 0 16px; }
body > footer .foot-bar {
  height: 34px;
  padding: 0;
  border-top: none;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, .66);
}
.foot-bar .ef-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.foot-bar .ef-brand .bi { color: #9fe0bf; font-size: 13px; }
.foot-bar .ef-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot-bar .ef-links {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}
body > footer .foot-bar a {
  color: rgba(255, 255, 255, .74);
  text-decoration: none;
  transition: color .15s;
}
body > footer .foot-bar a:hover { color: #fff; text-decoration: underline; }

/* ---------- 窄屏适配 ---------- */
@media (max-width: 991.98px) {
  .eda-main { height: calc(100vh - 66px); }
  .eda-lib { width: 190px; }
  .eda-prop { width: 250px; }
  .etools-right .etb-txt .bi { margin: 0; }
  .site-navbar .container { height: 54px; }
  body { padding-top: 54px; }
  body > footer .foot-bar { height: auto; padding: 8px 0; flex-wrap: wrap; }
}
@media (max-width: 767.98px) {
  .eda-main { height: auto; min-height: 0; }
  .eda-body { flex-direction: column; }
  .eda-lib, .eda-prop { width: auto; max-height: 240px; border: none; border-bottom: 1px solid #e3dcc9; }
  .eda-center { height: 62vh; }
  .eda-toolbar { gap: 8px; }
  .eda-minimap { display: none; }
  body > footer .foot-bar { font-size: 11.5px; }
  .foot-bar .ef-note { display: none; }
  .foot-bar .ef-links { margin-left: 0; }
}

/* ============ 自定义元件编辑器 ============ */
.cust-mask{position:fixed;inset:0;background:rgba(20,30,26,.45);z-index:2000;display:flex;align-items:center;justify-content:center;padding:18px 0;overflow:auto}
.cust-win{width:860px;max-width:94vw;max-height:calc(100vh - 36px);overflow:auto;background:#fbfaf6;border-radius:12px;box-shadow:0 18px 60px -18px rgba(0,0,0,.4);border:1px solid var(--line)}
.cust-head{display:flex;align-items:center;gap:8px;padding:12px 16px;font-weight:700;color:var(--ink);border-bottom:1px solid var(--line);background:linear-gradient(180deg,#fff,#f6f4ec)}
.cust-head .bi{color:var(--green)}
.cust-x{margin-left:auto;border:none;background:none;font-size:22px;line-height:1;cursor:pointer;color:var(--muted)}
.cust-x:hover{color:#c05b4d}
.cust-body{display:flex;gap:0}
.cust-left{flex:1;padding:12px;border-right:1px solid var(--line)}
.cust-tools{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.cust-tools button{border:1px solid var(--line);background:#fff;border-radius:8px;padding:5px 12px;font-size:13px;cursor:pointer;color:var(--ink-2)}
.cust-tools button.on{background:var(--green);color:#fff;border-color:var(--green)}
.cust-tip{font-size:12px;color:var(--muted)}
#custCv,#fpCv{background:#fff;border:1px solid var(--line);border-radius:8px;cursor:crosshair;display:block;touch-action:none}
.cust-status{margin-top:8px;font-size:12.5px;color:var(--muted);min-height:18px}
.cust-right{width:250px;padding:14px;display:flex;flex-direction:column;gap:10px}
.cust-right label{font-size:12.5px;color:var(--muted);display:block;margin-bottom:3px}
.cust-right .pf-in{width:100%}
.cust-btn{border:none;border-radius:9px;padding:9px 12px;font-size:13.5px;font-weight:600;cursor:pointer}
.cust-btn.primary{background:var(--green);color:#fff}
.cust-btn.plain{background:#fff;border:1px solid var(--line);color:var(--ink-2)}
.cust-btn.danger{background:#fff;border:1px solid #e5c1bb;color:#c05b4d}
.cust-btn:hover{filter:brightness(.97)}
.cust-note{font-size:12px;color:var(--muted);line-height:1.7;border-top:1px dashed var(--line);padding-top:8px}
.lib-newbtn{float:right;font-size:12px;font-weight:600;color:var(--green);background:rgba(20,86,62,.08);border:none;border-radius:999px;padding:2px 10px;cursor:pointer}
.lib-newbtn:hover{background:var(--green);color:#fff}
