/* CAIE 共享登录弹窗 + 吸底 CTA · 单一来源
 * 引入：<link rel="stylesheet" href="assets/caie-auth.css">
 * JS：window.CaieAuth API，详见 caie-auth.js
 */

/* ========== 登录弹窗 ========== */
.caie-auth-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(11, 18, 32, 0.48);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.caie-auth-overlay.is-open { display: flex; animation: caie-fade-in .18s ease; }
@keyframes caie-fade-in { from { opacity: 0; } to { opacity: 1; } }

.caie-auth-card {
  width: 100%; max-width: 392px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 30px 30px 24px;
  position: relative; overflow: hidden;
  animation: caie-pop-in .22s cubic-bezier(.22,1,.36,1);
}
.caie-auth-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #0052d9 0%, #008aee 58%, #6fc4ff 100%);
}
@keyframes caie-pop-in {
  from { transform: scale(.96) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.caie-auth-close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; transition: background .15s, color .15s;
}
.caie-auth-close:hover { background: #f1f5f9; color: #334155; }
.caie-auth-close svg { width: 16px; height: 16px; }

.caie-auth-field { margin-bottom: 15px; }
.caie-auth-label { font-size: 12px; color: #475569; font-weight: 700; margin-bottom: 7px; display: block; }
.caie-auth-input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid #dbe3ef; border-radius: 10px;
  font-size: 15px; color: #0f172a; background: #fff;
  font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.caie-auth-input::placeholder { color: #9aa6b5; }
.caie-auth-input:focus { border-color: #0b66e4; box-shadow: 0 0 0 4px rgba(0, 82, 217, .10); background: #fff; }
.caie-auth-input.is-error { border-color: #ef4444; }

.caie-auth-vcode-row { display: flex; gap: 10px; align-items: stretch; }
.caie-auth-vcode-row .caie-auth-input { flex: 1; }
.caie-auth-vcode-btn {
  flex-shrink: 0; height: 46px; padding: 0 16px;
  border: 1px solid #bfdbfe; border-radius: 10px;
  background: #f2f7ff; color: #0052d9;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.caie-auth-vcode-btn:hover:not(:disabled) { background: #e7f0ff; border-color: #0052d9; color: #0045b8; }
.caie-auth-vcode-btn:disabled { opacity: .5; cursor: not-allowed; }

.caie-auth-error {
  position: absolute; top: 0; left: 0; right: 0;
  background: #fef2f2; border-bottom: 1px solid #fecaca;
  color: #dc2626; font-size: 13px; font-weight: 600;
  padding: 10px 14px 10px 38px; text-align: center;
  border-radius: 14px 14px 0 0;
  opacity: 0; transform: translateY(-100%);
  transition: opacity .25s, transform .25s;
  pointer-events: none; z-index: 10;
}
.caie-auth-error.is-show {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.caie-auth-error::before {
  content: "!"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: #fee2e2;
  color: #dc2626; font-size: 12px; font-weight: 800; display: flex;
  align-items: center; justify-content: center;
}

.caie-auth-submit {
  width: 100%; height: 48px;
  background: linear-gradient(135deg, #0052d9 0%, #008aee 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: inherit;
  margin-top: 10px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 10px 22px rgba(0, 82, 217, .24);
}
.caie-auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(0, 82, 217, .30); }
.caie-auth-submit:disabled { opacity: .5; cursor: not-allowed; }

.caie-auth-tip {
  font-size: 11.5px; color: #94a3b8;
  text-align: center; margin-top: 16px; line-height: 1.6;
}
.caie-auth-tip b { color: #0052d9; font-weight: 600; }

/* 移动端 */
@media (max-width: 768px) {
  .caie-auth-card { padding: 28px 20px 22px; max-width: none; border-radius: 14px; }
  .caie-auth-vcode-row { gap: 8px; }
  .caie-auth-vcode-btn { padding: 0 12px; }
}

/* ========== 认证报名弹窗 ========== */
.caie-cert-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(11, 8, 6, .54);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.caie-cert-overlay.is-open { display: flex; animation: caie-cert-fade .18s ease; }
@keyframes caie-cert-fade { from { opacity: 0; } to { opacity: 1; } }
.caie-cert-modal {
  width: min(92vw, 480px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  position: relative;
  background: #fff;
  border: 1px solid rgba(26, 24, 20, .1);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(11, 8, 6, .24);
  padding: 30px;
  color: #1a1814;
}
.caie-cert-modal::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #007aff, #4a9a6b, #7c5cbf);
}
.caie-cert-close {
  position: absolute; right: 14px; top: 14px;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: #f5f7fb;
  color: #6b6458;
  cursor: pointer;
  font-size: 20px; line-height: 1;
  transition: all .18s ease;
}
.caie-cert-close:hover { background: #edf3ff; color: #007aff; }
.caie-cert-kicker {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #007aff;
  font-weight: 700;
  margin-bottom: 8px;
}
.caie-cert-modal h3 {
  font-size: 24px;
  line-height: 1.18;
  color: #1a1814;
  margin: 0 0 8px;
  letter-spacing: 0;
}
.caie-cert-desc {
  font-size: 14px;
  line-height: 1.75;
  color: #6b6458;
  margin: 0 0 22px;
}
.caie-cert-list { display: flex; flex-direction: column; gap: 12px; }
.caie-cert-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  width: 100%;
  padding: 18px;
  border: 1px solid #e5edf8;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f9fbff);
  color: #1a1814;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: all .18s ease;
}
.caie-cert-card:hover {
  border-color: rgba(0, 122, 255, .34);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 122, 255, .09);
}
.caie-cert-card.is-selected {
  border-color: rgba(0, 122, 255, .58);
  background: linear-gradient(180deg, #f4f8ff, #fff);
  box-shadow: 0 10px 24px rgba(0, 122, 255, .1);
}
.caie-cert-card h4 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 5px;
  color: #1a1814;
}
.caie-cert-card p {
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  color: #6b6458;
}
.caie-cert-arrow {
  flex-shrink: 0;
  min-width: 42px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  background: #007aff;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 800;
}
.caie-cert-choice-note {
  min-height: 20px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.65;
  color: #007aff;
}
@media (max-width: 768px) {
  .caie-cert-modal { padding: 26px 20px; }
  .caie-cert-card { align-items: flex-start; }
}
@media (max-width: 480px) {
  .caie-cert-modal h3 { font-size: 21px; }
}

/* ========== 吸底 CTA 栏 ========== */
.caie-sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 950;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(99, 102, 241, .18);
  padding: 14px 32px max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 28px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.caie-sticky-bar--center-only { gap: 0; }
.caie-sticky-bar-slogan {
  font-size: 14.5px; color: rgba(255, 255, 255, .82); font-weight: 400;
  flex: 0 1 auto; text-align: center;
  min-width: 0; max-width: min(56vw, 620px);
}
.caie-sticky-bar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 30px; border-radius: 8px;
  background: linear-gradient(135deg, #0052d9, #008aee);
  color: #fff; font-size: 14.5px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  border: none; font-family: inherit;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(0, 82, 217, .35);
  white-space: nowrap;
}
.caie-sticky-bar-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0, 82, 217, .5); color: #fff; }
.caie-sticky-bar-btn .arrow { width: 14px; height: 14px; }

@media (max-width: 768px) {
  .caie-sticky-bar { padding: 10px 16px max(10px, env(safe-area-inset-bottom)); gap: 12px; }
  .caie-sticky-bar-slogan { display: none; }
  .caie-sticky-bar-btn { padding: 12px 28px; font-size: 14px; width: 100%; max-width: 320px; justify-content: center; }
}

/* 给 body 留出吸底栏的高度，避免遮挡内容 */
body.caie-has-sticky { padding-bottom: 78px; }
@media (max-width: 768px) { body.caie-has-sticky { padding-bottom: 68px; } }

/* ========== Toast 浮层（登录后反馈） ========== */
.caie-toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-12px);
  z-index: 10000;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
  display: flex; align-items: center; gap: 10px;
  max-width: 90vw;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.caie-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.caie-toast .caie-toast-icon { flex-shrink: 0; width: 18px; height: 18px; color: #6fc4ff; }
.caie-toast b { color: #6fc4ff; font-weight: 700; }

/* ========== 顶栏登录态头像（覆盖 caie-nav.js 的 .nav-login-btn） ========== */
#caie-site-nav .nav-login-btn.caie-logged-in {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #0b66e4 0%, #38bdf8 100%) !important;
  color: #fff !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 6px 16px rgba(0, 82, 217, .22), 0 0 0 1px rgba(0, 82, 217, .14) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}
#caie-site-nav .nav-login-btn.caie-logged-in:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #0052d9 0%, #0ea5e9 100%) !important;
  border-color: #ffffff !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(0, 82, 217, .28), 0 0 0 1px rgba(0, 82, 217, .18) !important;
}
#caie-site-nav .nav-login-btn.caie-logged-in .caie-nav-avatar {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#caie-site-nav .nav-login-btn.caie-logged-in .caie-nav-avatar svg {
  width: 19px;
  height: 19px;
}
#caie-site-nav .nav-login-btn.caie-logged-in .caie-nav-avatar-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== 顶栏用户头像下拉菜单（已登录态） ========== */
#caie-site-nav .caie-nav-user {
  position: relative !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #0b66e4 0%, #38bdf8 100%) !important;
  color: #fff !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 6px 16px rgba(0, 82, 217, .22), 0 0 0 1px rgba(0, 82, 217, .14) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  overflow: visible !important;
  font-size: 0 !important;
  line-height: 0 !important;
  font-weight: 400 !important;
}
#caie-site-nav .caie-nav-user:hover {
  transform: translateY(-1px) !important;
  background: linear-gradient(135deg, #0052d9 0%, #0ea5e9 100%) !important;
  border-color: #ffffff !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(0, 82, 217, .28), 0 0 0 1px rgba(0, 82, 217, .18) !important;
}
#caie-site-nav .caie-nav-user .caie-nav-avatar {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#caie-site-nav .caie-nav-user .caie-nav-avatar svg {
  width: 19px;
  height: 19px;
}
#caie-site-nav .caie-nav-user .caie-nav-avatar-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* 下拉面板 */
#caie-site-nav .caie-nav-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  right: -16px;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15,23,42,0.12);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 950;
}
#caie-site-nav .caie-nav-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 28px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(45deg);
}
#caie-site-nav .caie-nav-user:hover .caie-nav-dropdown,
#caie-site-nav .caie-nav-user:focus-within .caie-nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#caie-site-nav .caie-nav-dropdown a {
  display: block;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.2;
  font-weight: 600;
  color: #0f172a;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
#caie-site-nav .caie-nav-dropdown a:hover {
  background: #f1f5f9;
  color: #0052d9;
}
#caie-site-nav .caie-nav-dropdown .caie-nav-logout {
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
  padding-top: 12px;
  color: #ef4444;
}
#caie-site-nav .caie-nav-dropdown .caie-nav-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ========== 退出登录确认弹窗 ========== */
.caie-logout-overlay {
  position: fixed; inset: 0; z-index: 9997;
  background: rgba(11, 8, 6, .46);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.caie-logout-overlay.is-open { display: flex; animation: caie-logout-fade .18s ease; }
@keyframes caie-logout-fade { from { opacity: 0; } to { opacity: 1; } }

.caie-logout-card {
  width: 100%; max-width: 360px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 32px 28px 24px;
  text-align: center;
  animation: caie-logout-pop .22s cubic-bezier(.22,1,.36,1);
}
@keyframes caie-logout-pop {
  from { transform: scale(.92) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.caie-logout-icon {
  width: 52px; height: 52px; margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef2f2, #fff1f2);
  display: flex; align-items: center; justify-content: center;
}
.caie-logout-icon svg { width: 24px; height: 24px; color: #ef4444; }

.caie-logout-card h4 {
  font-size: 18px; font-weight: 700; color: #0f172a;
  margin: 0 0 8px;
}
.caie-logout-card p {
  font-size: 13.5px; color: #64748b; line-height: 1.6;
  margin: 0 0 24px;
}
.caie-logout-actions {
  display: flex; gap: 10px;
}
.caie-logout-cancel, .caie-logout-confirm {
  flex: 1; height: 42px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; border: none;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.caie-logout-cancel {
  background: #f1f5f9; color: #475569;
}
.caie-logout-cancel:hover { background: #e2e8f0; }
.caie-logout-confirm {
  background: #ef4444; color: #fff;
  box-shadow: 0 6px 16px rgba(239, 68, 68, .24);
}
.caie-logout-confirm:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, .32);
}
@media (max-width: 480px) {
  .caie-logout-card { padding: 28px 20px 20px; }
}
