/* =========================================================
   管理员 Web 端样式
   ========================================================= */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
}

/* =========================================================
   登录 / OTP 卡片
   ========================================================= */

#loginBox,
#otpBox {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.admin-login-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border-radius: 18px;
  padding: 36px 34px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  animation: cardIn 0.35s ease-out;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.admin-login-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.admin-login-card h2 {
  margin: 8px 0 6px;
  text-align: center;
  font-size: 21px;
  color: #4a2b66;
  font-weight: bold;
}

.admin-login-sub {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin: 0 0 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e4e4e8;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafc;
}

.form-group input:focus {
  border-color: #9b59b6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(155, 89, 182, 0.12);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(142, 68, 173, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.4);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: #c8d0d8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: 1.5px solid #e4e4e8;
  border-radius: 10px;
  background: #fff;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-ghost:hover {
  background: #f7f7fa;
  border-color: #c9c9d1;
}

.form-msg {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  min-height: 18px;
  color: #c0392b;
}

/* =========================================================
   OTP 卡片细节
   ========================================================= */

.otp-card {
  padding-top: 30px;
}

.otp-icon-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
}

.otp-icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  opacity: 0.12;
  animation: pulseRing 2.4s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 0.12; }
  50%      { transform: scale(1.12); opacity: 0.2; }
}

.otp-icon-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #8e44ad;
}

.otp-sub {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin: 0;
}

.otp-email {
  text-align: center;
  color: #4a2b66;
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 22px;
  word-break: break-all;
}

/* ===== 六格输入框 ===== */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  color: #4a2b66;
  border: 2px solid #e4e4e8;
  border-radius: 10px;
  background: #fafafc;
  outline: none;
  transition: border-color 0.15s, background 0.15s,
              box-shadow 0.15s, transform 0.1s;
  font-family: Consolas, Menlo, monospace;
  caret-color: #9b59b6;
}

.otp-inputs input:focus {
  border-color: #9b59b6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(155, 89, 182, 0.15);
  transform: translateY(-2px);
}

.otp-inputs input.filled {
  border-color: #9b59b6;
  background: #f6effa;
}

.otp-inputs input.error {
  border-color: #e74c3c;
  background: #fdecea;
  animation: shake 0.35s;
}

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

/* ===== TTL 进度条 ===== */
.otp-ttl-bar {
  height: 3px;
  background: #f0f0f4;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.otp-ttl-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #9b59b6, #8e44ad);
  border-radius: 3px;
  transition: width 1s linear, background 0.5s;
}

.otp-ttl-progress.warn {
  background: linear-gradient(90deg, #f39c12, #e67e22);
}

.otp-ttl-progress.danger {
  background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.otp-ttl {
  text-align: center;
  font-size: 12px;
  color: #888;
  min-height: 16px;
  margin-bottom: 6px;
}

.otp-ttl.warn   { color: #e67e22; }
.otp-ttl.danger { color: #c0392b; }

/* =========================================================
   主界面（保持不变）
   ========================================================= */

#mainBox {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 380px 1fr;
  grid-template-areas:
    "header    header"
    "structure teacher";
  height: 100vh;
  overflow: hidden;
  background: #f5f7fa;
}

#mainBox header {
  grid-area: header;
  background: #8e44ad;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

#mainBox header #who { font-weight: bold; }

#mainBox header #clientStatus {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.3s;
}

#mainBox header #logoutBtn {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
#mainBox header #logoutBtn:hover {
  background: rgba(255, 255, 255, 0.15);
}

#mainBox header #changePwdBtn {
  padding: 6px 14px;
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
#mainBox header #changePwdBtn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---------- 结构树 ---------- */
#structureBox {
  grid-area: structure;
  background: #fff;
  border-right: 1px solid #e5e9f0;
  padding: 16px 12px;
  overflow-y: auto;
}

#structureBox h3,
#teacherBox h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #8e44ad;
}

.struct-node {
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.struct-node:hover { background: #f7f0fb; }
.struct-node.selected {
  background: #f0e4f7;
  color: #8e44ad;
  font-weight: bold;
}

.struct-node.level-school  { padding-left: 6px;  font-weight: bold; }
.struct-node.level-term    { padding-left: 20px; }
.struct-node.level-course  { padding-left: 36px; }
.struct-node.level-class   { padding-left: 52px; color: #555; }

/* ---------- 右侧发布者表 ---------- */
#teacherBox {
  grid-area: teacher;
  padding: 16px 20px;
  overflow-y: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
table.data-table th,
table.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
}
table.data-table th {
  background: #faf5fd;
  color: #666;
  font-weight: normal;
}
table.data-table tr:hover td { background: #fdfaff; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 6px;
  margin-bottom: 6px;
}
.btn-primary   { background: #9b59b6; color: #fff; }
.btn-primary:hover   { background: #8e44ad; }
.btn-success   { background: #2ecc71; color: #fff; }
.btn-success:hover   { background: #27ae60; }
.btn-danger    { background: #e74c3c; color: #fff; }
.btn-danger:hover    { background: #c0392b; }
.btn-ghost {
  background: #fff;
  color: #8e44ad;
  border: 1px solid #d9c2e6;
}
.btn-ghost:hover { background: #faf5fd; }
.btn:disabled { background: #c8d6e5; cursor: not-allowed; }

#structureOps {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.hint {
  font-size: 12px;
  color: #999;
  line-height: 1.6;
  margin-top: 8px;
}

/* ---------- 客户端详情弹窗 ---------- */
#clientDetailBox table.data-table {
  box-shadow: none;
  border: 1px solid #eef2f7;
}
#clientDetailBox table.data-table th {
  background: #faf5fd;
}