/* ============================================================
   亿美互联 · IDC 用户控制台 — 弹出登录窗口（idc-console 模板）
   用途：嵌入站点既有页面（home.layouts.site / home.layouts.app）
   ★ 样式全部限定在 .idc-auth 作用域内，设计变量不使用 :root，
     避免与站点现有 .site-header / .pane / .input-wrap 等类名冲突。
   ============================================================ */

.idc-auth,
.idc-auth-toast {
  --primary: #E8481F;
  --primary-600: #CF3A12;
  --primary-50: #FEF4F0;
  --grad: linear-gradient(135deg, #FF9430 0%, #F0551F 55%, #E8281A 100%);
  --text-1: #1F2329;
  --text-2: #4E5969;
  --text-3: #86909C;
  --border: #E5E6EB;
  --wechat: #07C160;
  --wechat-bg: #EAFBF1;
  --qq: #12B7F5;
  --qq-bg: #E9F7FE;
  --err: #F53F3F;
  --radius-lg: 18px;
  --radius-md: 10px;
  --shadow-btn: 0 6px 18px rgba(232, 72, 31, .28);
}

/* ---------- 基础重置（仅弹窗内部） ----------
   模板原 style.css 里有全局 button/a/input 重置，为不影响站点其他元素，
   这里只把重置限定在 .idc-auth 内：清掉浏览器默认的按钮边框/背景/内边距，
   并给链接恢复品牌色，否则会出现「按钮有边框」「快速注册没颜色」等问题。 */
.idc-auth button {
  font-family: inherit; font-size: inherit; line-height: inherit;
  cursor: pointer; border: none; background: none; color: inherit;
  padding: 0; border-radius: 0;
}
.idc-auth input { font-family: inherit; }
.idc-auth a { color: var(--primary); text-decoration: none; transition: color .2s; }
.idc-auth a:hover { color: var(--primary-600); }

/* ---------- 表单 ---------- */
.idc-auth .form-body { margin-top: 22px; display: grid; gap: 18px; }
.idc-auth .field label.fl {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px;
}
.idc-auth .input-wrap { position: relative; display: flex; align-items: center; }
.idc-auth .input-wrap .lead-ico {
  position: absolute; left: 13px; width: 18px; height: 18px;
  color: var(--text-3); pointer-events: none; transition: color .2s;
}
.idc-auth .input-wrap input {
  width: 100%; height: 46px; padding: 0 14px 0 40px;
  font-size: 14px; color: var(--text-1); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.idc-auth .input-wrap input::placeholder { color: #B6BCC4; }
.idc-auth .input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232, 72, 31, .12); }
.idc-auth .input-wrap:focus-within .lead-ico { color: var(--primary); }

/* 密码显隐 */
.idc-auth .pwd-toggle {
  position: absolute; right: 8px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 8px; color: var(--text-3); transition: .2s;
}
.idc-auth .pwd-toggle:hover { color: var(--primary); background: var(--primary-50); }
.idc-auth .pwd-toggle svg { width: 18px; height: 18px; }
.idc-auth .pwd-toggle .ico-eye-off { display: none; }
.idc-auth .pwd-toggle.active .ico-eye { display: none; }
.idc-auth .pwd-toggle.active .ico-eye-off { display: block; }

/* 校验错误态 */
.idc-auth .field-err { display: none; font-size: 12px; color: var(--err); margin-top: 6px; }
.idc-auth .field.invalid .input-wrap input { border-color: var(--err); }
.idc-auth .field.invalid .input-wrap input:focus { box-shadow: 0 0 0 3px rgba(245, 63, 63, .12); }
.idc-auth .field.invalid .field-err { display: block; animation: idcErrIn .25s ease; }
@keyframes idcErrIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* 行内布局 */
.idc-auth .form-row { display: flex; align-items: center; justify-content: space-between; }
.idc-auth .form-row a { font-size: 13px; color: var(--text-2); text-decoration: none; }
.idc-auth .form-row a:hover { color: var(--primary); }

/* 复选框 */
.idc-auth .ck {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text-2); cursor: pointer; user-select: none; position: relative;
}
.idc-auth .ck input { position: absolute; opacity: 0; width: 0; height: 0; }
.idc-auth .ck .box {
  flex: none; width: 16px; height: 16px; border: 1px solid var(--border);
  border-radius: 4px; display: grid; place-items: center; transition: .18s; background: #fff;
}
.idc-auth .ck .box svg { width: 10px; height: 10px; color: #fff; opacity: 0; transform: scale(.5); transition: .18s; }
.idc-auth .ck input:checked + .box { background: var(--primary); border-color: var(--primary); }
.idc-auth .ck input:checked + .box svg { opacity: 1; transform: scale(1); }

/* 主按钮 */
.idc-auth .btn-primary {
  position: relative; width: 100%; height: 46px;
  border-radius: var(--radius-md); background: var(--grad); color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: .08em;
  box-shadow: var(--shadow-btn);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.idc-auth .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(232, 72, 31, .34); filter: saturate(1.06); }
.idc-auth .btn-primary:active { transform: translateY(0); }
.idc-auth .btn-primary:disabled { opacity: .75; cursor: not-allowed; transform: none; }
.idc-auth .btn-primary .spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%;
  animation: idcSpin .7s linear infinite; display: none;
}
.idc-auth .btn-primary.loading .spinner { display: block; }
@keyframes idcSpin { to { transform: rotate(360deg); } }

/* 手机号 + 验证码 */
.idc-auth .code-field { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.idc-auth .btn-code {
  height: 46px; padding: 0 16px; border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: 13px; color: var(--primary);
  background: var(--primary-50); white-space: nowrap; transition: .2s;
}
.idc-auth .btn-code:hover:not(:disabled) { border-color: var(--primary); }
.idc-auth .btn-code:disabled { color: var(--text-3); background: #F2F3F5; border-color: var(--border); cursor: not-allowed; }

/* 登录方式切换面板 */
.idc-auth .pane { display: none; }
.idc-auth .pane.active { display: grid; gap: 18px; animation: idcPaneIn .3s ease; }
@keyframes idcPaneIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.idc-auth .back-link {
  justify-self: center; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3); transition: .2s;
}
.idc-auth .back-link:hover { color: var(--primary); }

/* 分割线 */
.idc-auth .divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--text-3); font-size: 12px; }
.idc-auth .divider::before, .idc-auth .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 弹出登录层 ---------- */
.idc-auth .modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(23, 26, 32, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 20px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  opacity: 0; visibility: hidden; transition: opacity .28s, visibility .28s;
}
.idc-auth .modal-overlay.open { opacity: 1; visibility: visible; }
.idc-auth .modal-card {
  position: relative; width: 100%; max-width: 380px;
  margin: auto; /* 空间充足时垂直居中，屏幕过矮时自动可滚动，避免顶部被裁切 */
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  padding: 34px 34px 26px;
  transform: translateY(14px) scale(.96); opacity: 0;
  transition: transform .3s cubic-bezier(.22, .68, .36, 1), opacity .3s;
}
.idc-auth .modal-overlay.open .modal-card { transform: none; opacity: 1; }
.idc-auth .modal-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: .2s;
}
.idc-auth .modal-close:hover { background: #F2F3F5; color: var(--text-1); }
.idc-auth .modal-close svg { width: 16px; height: 16px; }
.idc-auth .modal-title { font-size: 20px; font-weight: 700; text-align: center; }
.idc-auth .modal-sub { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* 三方登录 */
.idc-auth .modal-social { display: flex; justify-content: center; gap: 30px; }
.idc-auth .ms-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2); transition: color .2s;
}
.idc-auth .ms-item .bubble {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: transform .22s;
}
.idc-auth .ms-item svg { width: 22px; height: 22px; }
.idc-auth .ms-item.wechat .bubble { background: var(--wechat-bg); color: var(--wechat); }
.idc-auth .ms-item.qq .bubble { background: var(--qq-bg); color: var(--qq); }
.idc-auth .ms-item.phone .bubble { background: var(--primary-50); color: var(--primary); }
.idc-auth .ms-item:hover .bubble { transform: translateY(-3px); }
.idc-auth .ms-item.wechat:hover { color: var(--wechat); }
.idc-auth .ms-item.qq:hover { color: var(--qq); }
.idc-auth .ms-item.phone:hover { color: var(--primary); }
.idc-auth .modal-foot { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-3); }
.idc-auth .modal-foot a { text-decoration: none; }

/* ---------- 微信扫码浮层 ---------- */
.idc-auth .wx-overlay {
  position: fixed; inset: 0; z-index: 3100;
  display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(31, 35, 41, .45); backdrop-filter: blur(4px);
}
.idc-auth .wx-overlay.open { display: flex; }
.idc-auth .wx-card {
  position: relative; width: 340px; max-width: 100%; background: #fff;
  border-radius: var(--radius-lg); box-shadow: 0 10px 48px rgba(31, 35, 41, .18);
  padding: 28px 24px 24px; text-align: center;
}
.idc-auth .wx-card h3 { font-size: 17px; color: var(--text-1); }
.idc-auth .wx-card p { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.idc-auth .wx-card iframe { width: 300px; height: 340px; border: none; margin-top: 14px; }
.idc-auth .wx-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-3);
}
.idc-auth .wx-close:hover { background: var(--primary-50); color: var(--primary); }
.idc-auth .wx-close svg { width: 16px; height: 16px; }

/* ---------- Toast 轻提示（容器挂在 body，用 .idc-auth-toast 继承变量） ---------- */
.idc-auth-toast {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  z-index: 3200; display: grid; gap: 10px; justify-items: center; pointer-events: none;
}
.idc-auth-toast .toast {
  background: rgba(31, 35, 41, .88); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  opacity: 0; transform: translateY(-10px); transition: .3s;
  display: flex; align-items: center; gap: 8px; max-width: 82vw;
}
.idc-auth-toast .toast.show { opacity: 1; transform: none; }
.idc-auth-toast .toast .dot { width: 6px; height: 6px; border-radius: 50%; background: #FF9430; flex: none; }
.idc-auth-toast .toast-success .dot { background: #00B42A; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .idc-auth .modal-card { padding: 28px 22px 22px; }
  .idc-auth .modal-social { gap: 20px; }
  .idc-auth .input-wrap input { font-size: 16px; } /* 防止 iOS 聚焦自动放大 */
  .idc-auth-toast { top: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .idc-auth *, .idc-auth *::before, .idc-auth *::after,
  .idc-auth-toast *, .idc-auth-toast *::before, .idc-auth-toast *::after {
    animation-duration: .01ms !important; transition-duration: .01ms !important;
  }
}
