/* ==========================================================
   NIUCLOUD 安装向导样式
   ========================================================== */
:root {
  --blue: #2563EB;
  --blue-dark: #1D4FD7;
  --blue-bg: #EFF4FF;
  --blue-line: #C9D8F8;
  --green: #16A34A;
  --green-bg: #ECFDF5;
  --green-line: #A7F3D0;
  --green-dark: #166534;
  --red: #E5484D;
  --red-bg: #FEF3F2;
  --red-line: #FECDCA;
  --red-text: #B42318;
  --red-term: #FF9BA0;
  --amber: #F59E0B;
  --amber-bg: #FFFAEB;
  --amber-line: #FDE68A;
  --amber-text: #92400E;
  --ink: #161A20;
  --label: #3E4756;
  --sub: #616B7C;
  --muted: #8B95A5;
  --hint: #A0A9B6;
  --line: #ECF0F3;
  --input-line: #DFE3E8;
  --divider: #EEF1F4;
  --page: #F6F7F9;
  --panel: #F8FAFC;
  --panel2: #FCFCFD;
  --terminal: #101828;
  --term-text: #C9D3E0;
  --term-ok: #7EE2A8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page);
  color: var(--ink);
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { text-decoration: none; }
.mono { font-family: "JetBrains Mono", Consolas, "Courier New", monospace; }
.hide { display: none !important; }

/* ============ 左侧菜单 ============ */
.sidebar {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 30px 26px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.brand-ver { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1; }

.sec-label {
  margin-top: 30px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
  letter-spacing: .08em;
}

.steps { margin-top: 14px; }
.step { display: flex; gap: 14px; user-select: none; }
.step-rail { width: 30px; display: flex; flex-direction: column; align-items: center; }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: #fff;
  border: 1.5px solid #DCE1E8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #A9B2BF;
  font-weight: 400;
}

.step-connector { width: 2px; height: 26px; background: #E4E8EE; }
.step-info { padding-top: 3px; flex: 1; }
.step-title { font-size: 14px; color: #5A6472; line-height: 1.5; }
.step-desc { font-size: 12px; color: var(--hint); margin-top: 4px; line-height: 1.4; }

.step.active .step-dot { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.step.active .step-title { color: var(--blue); font-weight: 600; }
.step.done .step-dot { background: var(--blue); border-color: var(--blue); color: #fff; font-size: 12px; }
.step.done .step-title { color: var(--label); }
.step.done + .step .step-connector { background: var(--blue-line); }

.sidebar-spacer { flex: 1; }
.sidebar-divider { height: 1px; background: var(--divider); margin-bottom: 16px; }

.help-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.help-row svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; }
.help-row a { color: var(--blue); font-weight: 600; }
.help-row a:hover { text-decoration: underline; }

/* ============ 右侧内容（头部/底部固定，中间独立滚动，内容水平居中） ============ */
.main { flex: 1; min-width: 0; height: 100vh; overflow: hidden; display: flex; }

.screen {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen-head {
  flex-shrink: 0;
  padding: 36px 48px 0;
  background: var(--page);
}

.screen-head.is-scrolled { box-shadow: 0 1px 0 var(--line); }

.screen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 48px 4px;
  scrollbar-gutter: stable;
}

.screen-foot {
  flex-shrink: 0;
  padding: 14px 48px 18px;
  background: var(--page);
  border-top: 1px solid var(--line);
}

/* 三块区域内的内容统一限宽并左右居中（分割线、底色仍铺满右侧空间） */
.screen-head > *,
.screen-body > *,
.screen-foot > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.screen-foot .footer-bar { margin-top: 0; }

.page-title { font-size: 22px; font-weight: 600; color: var(--ink); }
.page-sub { font-size: 13px; color: var(--sub); margin-top: 7px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 22px;
  box-shadow: 0 4px 20px -4px rgba(15, 23, 42, .05);
  overflow: hidden;
}

.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.card-head-left { display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-divider { height: 1px; background: var(--divider); }

.badge { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; background: var(--green-bg); color: var(--green); }
.badge.err { background: var(--red-bg); color: var(--red); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
}

.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--label); border: 1px solid var(--input-line); }
.btn-secondary:hover { border-color: #C4CBD6; background: #FAFBFC; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #D7373C; }
.btn-sm { height: 38px; padding: 0 20px; }
.btn[disabled], .btn[disabled]:hover { background: #E8EBEF; color: #A9B2BF; border-color: #E8EBEF; cursor: not-allowed; }

.footer-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.footer-hint { font-size: 12px; color: var(--muted); }
.btn-group { display: flex; gap: 12px; }
.link-btn { font-size: 13px; font-weight: 600; color: var(--blue); cursor: pointer; background: none; border: none; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ============ 01 许可协议 ============ */
.agree-body {
  background: var(--panel2);
  padding: 22px 26px;
  max-height: 420px;
  overflow-y: auto;
}

.agree-body h4 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 18px 0 8px; }
.agree-body h4:first-child { margin-top: 0; }
.agree-body p { font-size: 13px; color: #4A5464; line-height: 1.8; margin-bottom: 10px; }
.agree-body ol { margin: 0 0 10px 18px; }
.agree-body li { font-size: 13px; color: #4A5464; line-height: 1.9; list-style: decimal; }
.agree-body strong { color: var(--ink); font-weight: 600; }

.agree-foot { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; flex-wrap: wrap; gap: 12px; }
.agree-check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }

.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid #C4CBD6;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}

.checkbox svg { width: 12px; height: 12px; display: none; }
.agree-check.checked .checkbox { background: var(--blue); border-color: var(--blue); }
.agree-check.checked .checkbox svg { display: block; }
.agree-check span { font-size: 14px; color: var(--ink); }
.agree-check.shake .checkbox { border-color: var(--red); animation: ncShake .4s; }

@keyframes ncShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ============ 02 环境检测 ============ */
.summary-banner {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--green-bg);
  border: 1px solid var(--green-line);
}

.summary-banner.fail { background: var(--red-bg); border-color: var(--red-line); }
.summary-banner.fail .summary-text { color: var(--red-text); }
.summary-left { display: flex; align-items: center; gap: 10px; }
.summary-left svg { width: 18px; height: 18px; flex-shrink: 0; }
.summary-text { font-size: 13px; font-weight: 600; color: var(--green-dark); }

.env-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 20px; }
.env-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--divider);
}

.env-item .name { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-item .val { font-size: 12px; color: var(--green); }
.env-item .val.err { color: var(--red); }

/* 状态图标（纯 CSS 绘制） */
.icon { width: 16px; height: 16px; border-radius: 8px; position: relative; flex-shrink: 0; display: inline-block; }
.icon.ok { background: var(--green); }
.icon.ok::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 8px;
  height: 4px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg);
}
.icon.err { background: var(--red); }
.icon.err::before, .icon.err::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 7.2px;
  width: 9px;
  height: 1.6px;
  background: #fff;
  border-radius: 1px;
}
.icon.err::before { transform: rotate(45deg); }
.icon.err::after { transform: rotate(-45deg); }

.perm-list { padding: 4px 0 8px; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; }
.perm-row:nth-child(even) { background: var(--panel2); }
.perm-path { font-size: 13px; color: var(--ink); flex: 1; word-break: break-all; }
.perm-badges { display: flex; gap: 8px; flex-shrink: 0; }

.perm-badge {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--green-bg);
  color: var(--green);
  font-weight: 600;
}

.perm-badge.err { background: var(--red-bg); color: var(--red); }

/* ============ 03 参数配置 ============ */
.form-section-head { display: flex; align-items: center; gap: 10px; padding: 18px 24px 6px; }
.form-section-head svg { width: 18px; height: 18px; }
.form-section-head .t { font-size: 15px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; padding: 8px 24px; }
.form-grid.last { padding-bottom: 24px; }

.field label { display: block; font-size: 13px; font-weight: 600; color: var(--label); margin-bottom: 6px; }
.field label .required { color: var(--red); margin-right: 2px; }

.input {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--input-line);
  background: #fff;
  padding: 0 14px;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
  font-family: inherit;
  outline: none;
  transition: border .15s, box-shadow .15s;
}

.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.input::placeholder { color: #A9B2BF; }
.input.mono { font-family: "JetBrains Mono", Consolas, monospace; }
.input:disabled, .input[readonly] { background: #F5F7F9; border-color: #E8EBEF; color: var(--muted); cursor: not-allowed; }

.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 17px; display: flex; align-items: center; }
.field-hint.ok { color: var(--green); font-weight: 600; }
.field-hint.err { color: var(--red); font-weight: 600; }
.field-hint.loading { color: var(--blue); font-weight: 600; }
.field-hint .spinner {
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid var(--blue-line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ncSpin .7s linear infinite;
}

@keyframes ncSpin { to { transform: rotate(360deg); } }

.alert-bar {
  margin: 8px 24px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
}

.alert-bar svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-bar span { font-size: 12.5px; color: var(--red-text); }
.section-divider { height: 1px; background: var(--divider); }

/* ============ 04 安装中 ============ */
.progress-wrap { padding: 22px 24px 20px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; }
.progress-label { font-size: 15px; font-weight: 600; }
.progress-num { font-size: 20px; font-weight: 700; color: var(--blue); }
.progress-track { height: 8px; border-radius: 4px; background: #E8ECF1; margin-top: 14px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--blue); width: 0; transition: width .3s ease; }
.progress-fill.err { background: var(--red); }

.stage-row { display: flex; align-items: center; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #A9B2BF; }
.stage .dot { width: 14px; height: 14px; border-radius: 7px; border: 1.4px solid #C4CBD6; background: #fff; position: relative; }
.stage.done { color: var(--label); }
.stage.done .dot { border: none; background: var(--green); }
.stage.done .dot::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg);
  position: absolute;
  left: 3px;
  top: 4px;
}
.stage.current { color: var(--blue); font-weight: 600; }
.stage.current .dot { border: 1.4px solid var(--blue); background: var(--blue); box-shadow: inset 0 0 0 3px #fff; }

.terminal {
  margin: 0 24px 24px;
  background: var(--terminal);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 230px;
  max-height: 340px;
  overflow-y: auto;
}

.term-line { font-size: 12.5px; color: var(--term-text); line-height: 1.5; word-break: break-all; }
.term-line .term-time { color: #78859B; margin-right: 8px; }
.term-line.ok { color: var(--term-ok); }
.term-line.err { color: var(--red-term); font-weight: 600; }
.term-line .term-tag { display: inline-block; margin-left: 8px; font-weight: 600; }
.term-empty { font-size: 12.5px; color: #78859B; }
.terminal::-webkit-scrollbar-thumb { background: #3A4557; }

.notice-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.notice-row svg { width: 14px; height: 14px; }

/* ============ 05 安装失败 ============ */
.error-banner {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
}

.error-left { display: flex; align-items: center; gap: 12px; }
.error-left svg { width: 18px; height: 18px; flex-shrink: 0; }
.error-text { font-size: 13.5px; font-weight: 600; color: var(--red-text); word-break: break-all; }

/* ============ 06 安装完成 ============ */
.success-area { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 24px 26px; }
.success-icon { width: 72px; height: 72px; border-radius: 36px; background: var(--green-bg); display: flex; align-items: center; justify-content: center; position: relative; }
.success-icon::before { content: ""; position: absolute; width: 44px; height: 44px; border-radius: 22px; background: var(--green); }
.success-icon svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.success-title { font-size: 20px; font-weight: 600; margin-top: 4px; }
.success-sub { font-size: 13px; color: var(--sub); text-align: center; }

.amber-tip {
  margin: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
}

.amber-tip svg { width: 16px; height: 16px; flex-shrink: 0; }
.amber-tip span { font-size: 12.5px; color: var(--amber-text); }

.entry-row { display: flex; gap: 14px; padding: 20px 24px 24px; flex-wrap: wrap; }
.entry-card {
  flex: 1;
  min-width: 200px;
  border: 1px solid #E8EBEF;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
}

.entry-card:hover { border-color: var(--blue); box-shadow: 0 4px 14px -4px rgba(37, 99, 235, .18); }
.entry-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; }
.entry-icon svg { width: 18px; height: 18px; }
.entry-name { font-size: 14px; font-weight: 600; }
.entry-url { font-size: 12px; color: var(--muted); word-break: break-all; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(10, 18, 32, .45);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-mask.show { display: flex; }

.modal {
  width: 100%;
  max-width: 420px;
  margin: auto;
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px 20px;
  box-shadow: 0 18px 44px -12px rgba(10, 16, 30, .26);
  animation: ncPop .18s ease;
}

@keyframes ncPop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-icon { width: 40px; height: 40px; flex-shrink: 0; }
.modal-icon svg { display: block; width: 100%; height: 100%; }
.modal-title { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.4; flex: 1; word-break: break-all; }
.modal-body { font-size: 13px; color: var(--sub); line-height: 1.75; word-break: break-all; margin-top: 14px; }
.modal-body:empty { display: none; }
.modal-btns { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }

/* ============ toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 200;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #C8CDD5; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #A9B2BF; }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .env-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  body { display: block; overflow: auto; }
  .sidebar { width: 100%; min-width: 0; height: auto; padding: 20px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar-spacer, .sidebar-divider { display: none; }
  .help-row { margin-top: 18px; }
  .main { display: block; height: auto; overflow: visible; }
  .screen { display: block; height: auto; overflow: visible; }
  .screen-head { padding: 24px 20px 0; }
  .screen-body { overflow: visible; padding: 0 20px; }
  .screen-foot { padding: 14px 20px 24px; border-top: none; }
  .screen-head.is-scrolled { box-shadow: none; }
  .form-grid { grid-template-columns: 1fr; }
  .env-grid { grid-template-columns: 1fr; }
  .footer-bar { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
  .btn-group { justify-content: flex-end; }
}
