/* style.css */
:root {
  --primary-color: #006eff;
  --success-color: #27ae60; /* 开启绿色 */
  --error-color: #e74c3c;
  --warning-color: #f39c12;
  --text-color: #2c3e50;

  /* 登录页配色：浅背景 + 更深卡片 */
  --login-bg: #f5f7fb;
  --login-card: #dfe3ec;
  --card-border: #c2c8d6;

  /* 配置页背景 */
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;

  --border-radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* ========== 登录页 ========== */
#loginWrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  background: var(--login-bg);
  position: relative;
  overflow: hidden;
}
#loginWrapper::before, 
#loginWrapper::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  filter: blur(2px);
  z-index: 0;
}
#loginWrapper::before {
  width: 260px; height: 260px;
  top: 12%; left: 14%;
}
#loginWrapper::after {
  width: 360px; height: 360px;
  bottom: 12%; right: 12%;
}
#loginCard {
  position: relative;
  z-index: 1;
  background: var(--login-card);
  border: 1px solid var(--card-border);
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: fadeIn 0.6s ease;
}
#loginCard h1 {
  font-size: 22px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 24px;
}
#loginForm input {
  width: 100%;
  padding: 12px 14px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border 0.3s, box-shadow 0.3s;
}
#loginForm input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 6px rgba(0, 110, 255, 0.2);
}
#loginBtn {
  width: 100%;
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #006eff, #00c6ff);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
#loginBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 110, 255, 0.25);
}
#error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--error-color);
  font-weight: bold;
  min-height: 18px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

* { box-sizing: border-box; transition: all 0.2s ease; }

body {
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg-color);
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: var(--text-color);
  padding-bottom: 60px;
}

/* 页面容器 */
.page-wrapper {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 12px;
}
.page-title {
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  margin: 16px 0;
  color: var(--text-color);
}

/* ====== 状态栏：左右布局 ====== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  font-size: 13px;
  margin-bottom: 12px;
}
.status-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-color);
}
.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cfg-label {
  font-size: 13px;
  color: var(--text-color);
  opacity: 0.9;
}
.config-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-width: 100px;
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
  line-height: 1.2;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border .2s, box-shadow .2s, transform .1s;
}
.config-select:hover { border-color: #b8c2d6; }
.config-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0,110,255,.12);
}
.change-pwd-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #006eff, #4aa3ff);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,110,255,0.18);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s ease;
  white-space: nowrap;
}
.change-pwd-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,110,255,0.22); }
.change-pwd-btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(0,110,255,0.18); }

/* 配置区 */
.container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
}
.config-columns { display: flex; gap: 20px; }
.config-left, .config-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.section-card {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 25px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}
.config-row {
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 8px;
  overflow: hidden;
}
.switch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border-radius: 6px;
}
.switch-header label {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  margin: 0;
}
.switch-header input[type="checkbox"],
.firewall-control input[type="checkbox"] {
  appearance: none;
  width: 38px;
  height: 20px;
  background: #ccc;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  margin-left: 12px;
  transition: background 0.3s;
}
.switch-header input[type="checkbox"]:checked,
.firewall-control input[type="checkbox"]:checked {
  background: var(--success-color);
}
.switch-header input[type="checkbox"]::after,
.firewall-control input[type="checkbox"]::after {
  content: "";
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}
.switch-header input[type="checkbox"]:checked::after,
.firewall-control input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}
.toggle-label {
  font-size: 12px;
  font-weight: bold;
  margin-left: 8px;
  color: #999;
}
.toggle-label.on { color: var(--success-color); }
.toggle-label.off { color: #999; }
.textarea-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.textarea-header label {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}
.collapse-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #777;
  padding: 2px 6px;
  border-radius: 4px;
}
.collapse-btn:hover { background: #eee; color: #333; }
.config-content {
  padding: 0 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}
.config-content.expanded {
  max-height: 2000px;
  opacity: 1;
  padding: 0 10px 10px;
}
.config-row textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-family: monospace;
  resize: vertical;
}
.bool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
button#saveBtn {
  background: var(--success-color);
  min-width: 220px;
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 6px;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s;

  /* ✅ 让图标和文字对齐 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  /* ✅ 居中按钮 */
  margin: 20px auto;
  display: flex;
  justify-content: center;
}


button#saveBtn:hover:enabled { background: #1e8449; transform: translateY(-2px); }
button#saveBtn:disabled { background: #95a5a6; cursor: not-allowed; }
.logout-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #bdc3c7;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  color: var(--text-color);
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: all 0.3s;
  z-index: 100;
}
.logout-btn:hover { background: #95a5a6; transform: translateY(-2px); }
.firewall-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 8px;
}
.firewall-control label {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  margin: 0;
}
.divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 12px 0;
}
#configWrapper { display: none; }
.firewall-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
#pwdModal {
  display: none;
  position: fixed; 
  top: 0; left: 0; 
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  justify-content: center; 
  align-items: center;
}
.modal-card {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.modal-card h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--primary-color);
}
.modal-card input {
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border 0.3s, box-shadow 0.3s;
}
.modal-card input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 6px rgba(0, 110, 255, 0.2);
}
.btn-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}
.btn-primary {
  flex: 1;
  margin-right: 8px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  background: linear-gradient(90deg, #006eff, #00c6ff);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0,110,255,0.3);
}
.btn-secondary {
  flex: 1;
  margin-left: 8px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  background: #bdc3c7;
  color: #2c3e50;
  cursor: pointer;
  transition: transform 0.2s;
}
.btn-secondary:hover {
  background: #95a5a6;
  transform: translateY(-2px);
}
.error-msg {
  color: var(--error-color);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* 登录页底部版权一行 */
.login-footer {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #666;
  z-index: 1;
}
.login-footer a {
  color: #666;
  text-decoration: none;
}
.login-footer a:hover {
  text-decoration: underline;
}

#copyConfigPathBtn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #006eff, #4aa3ff);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,110,255,0.18);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s ease;
  white-space: nowrap;
}

#copyConfigPathBtn:hover {
  transform: translateY(-1px);
  background: linear-gradient(90deg, #0056cc, #338dff);
  box-shadow: 0 4px 12px rgba(0,110,255,0.22);
}

#copyConfigPathBtn:active {
  transform: translateY(0);
  background: #004bb5;
  box-shadow: 0 2px 8px rgba(0,110,255,0.18);
}

/* 配置地址弹窗，和修改密码弹窗一致 */
#configModal {
  display: none;
  position: fixed; 
  top: 0; left: 0; 
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  justify-content: center; 
  align-items: center;
}
#configModal .modal-card {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  text-align: center;
  animation: fadeIn 0.3s ease;
}
#configUrl {
  width: 100%;
  padding: 10px;
  margin: 12px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: monospace;
}

/* ✅ 校验配置卡片内的对齐修复 */
#verifyConfigContainer .config-row {
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 8px;
  overflow: hidden;
  background: #fff;
}
#verifyConfigContainer .textarea-header {
  padding: 8px 10px;
  background: #fff;
  border-radius: 6px;
}
#verifyConfigContainer .config-content textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-family: monospace;
  resize: vertical;
}

.section-card .section-title {
  font-weight: bold;
}
.section-title {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 10px;
}
.section-title .icon {
  margin-right: 6px;
  flex-shrink: 0;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* 登录页禁止滚动 */
body.login-page {
  padding-bottom: 0;
}

/* 真正锁滚动的是登录 wrapper */
body.login-page #loginWrapper {
  height: 100vh;
  overflow: hidden;
}


/* ====== 响应式 ====== */
@media (max-width: 600px) {
  .firewall-controls { grid-template-columns: 1fr; }
  .config-columns { flex-direction: column; }
  .bool-grid { grid-template-columns: 1fr; }
  .status-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .status-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .config-select { flex: 1; min-width: 140px; }
}
