/* ============================================================
   统一登录平台登录页样式
   由 login-view 的 main.css + LoginView.vue + PasswordLogin.vue
   + SmsLogin.vue + toast.ts 合并移植；扫码登录改为钉钉内嵌二维码
   （右上角切换「扫码登录 / 短信·密码登录」两个视图）
   ============================================================ */

/* ========== 全局（main.css）========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #f0f2f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

input {
  font-family: inherit;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

.hidden {
  display: none !important;
}

/* ========== 页面布局（LoginView.vue）========== */
.login-page {
  display: flex;
  min-height: 100vh;
  background: #eef2f7;
}

/* ---------- 左侧品牌区域 ---------- */
.login-brand {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* cover：随屏幕自适应缩放，保持宽高比不压缩变形，超出部分裁剪 */
  background: url('/images/login-bg.png') center / cover no-repeat;
  color: white;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

/* 装饰光球 */
.brand-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.brand-orb-1 {
  top: -120px;
  right: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(22, 119, 255, 0.25) 0%, transparent 70%);
}

.brand-orb-2 {
  bottom: -160px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.15) 0%, transparent 70%);
}

.brand-footer {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  opacity: 0.45;
  z-index: 1;
}

/* ---------- 右侧登录区域 ---------- */
.login-form-area {
  /* 加宽右侧，并允许在大屏下按比例伸展 */
  flex: 0 1 640px;
  min-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: linear-gradient(180deg, #fafbff 0%, #eef3fb 100%);
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: transparent;
  /* 外框参考原设计（#homepage_login）：1px 浅灰虚线包围整个登录区 */
  border: 1px dashed #d6d9dc;
  /* 顶部留白拉大：标题距虚线框更远 */
  padding: 80px 36px 32px;
  position: relative;
}

/* ========== 视图切换（表单登录 / 钉钉扫码登录） ========== */
.login-view {
  display: none;
  /* 与表单视图等高（381px = 页签 39 + 间距 32 + 内容 310）：切换扫码时卡片高度保持不变，避免页面上下跳动 */
  min-height: 381px;
}

.login-view.active {
  display: block;
}

/* 右上角切换器（参考原设计：白色圆角图标盒 + 悬停气泡提示） */
.no-select {
  user-select: none;
  -ms-user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.corner-switch-wrap {
  position: absolute;
  /* 贴住外框右上角（原设计切换器位于容器右上角） */
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 5;
}

.sms-qr-switcher {
  background: #fff;
  border-radius: 4px;
  width: 50px;
  height: 48px;
  display: inline-block;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.sms-qr-switcher img {
  height: 100%;
  display: block;
  cursor: pointer;
}

.scavenging {
  background: #fff;
  border-radius: 4px;
  margin-top: 6px;
  display: none;
}

.corner-switch-wrap:hover .scavenging {
  display: block;
}

.scavenging img {
  display: block;
}


.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  /* 标题与表单区间距拉大 */
  margin-bottom: 60px;
}

.header-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: white;
}

.header-icon img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  /* 目标系统名（client_name）可能较长：省略号截断，不挤压左侧图标；全称见 title 提示 */
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 登录内容区 ========== */
.login-content {
  min-height: 310px;
}

.login-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.login-panel.active {
  display: flex;
}

/* ========== Tab 切换（参考原设计 .qrcode_title：文字页签 + 主题色下划线） ========== */
.login-tabs {
  display: flex;
  justify-content: center;
  /* 页签与表单区间距拉大（太近视觉上挤；用户拍板 32px） */
  margin: 0 4px 32px;
}

.login-tab {
  margin: 0 10px;
  padding: 0 0 15px;
  border: none;
  /* 透明占位与激活态同宽，切换时不产生高度跳动 */
  border-bottom: 3px solid transparent;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  color: #222222;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.login-tab.active {
  /* 原设计激活态：3px 主题色下划线 + 主题色文字 */
  border-bottom-color: #1677ff;
  color: #1677ff;
}

.login-tab:hover:not(.active) {
  color: #4096ff;
}

/* ========== 表单（PasswordLogin.vue / SmsLogin.vue 公共）========== */
.form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  display: flex;
  color: #bfbfbf;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 46px;
  padding: 0 12px 0 40px;
  border: 1.5px solid #e4e7ed;
  border-radius: 10px;
  font-size: 14px;
  color: #1a1a2e;
  transition: all 0.3s;
  outline: none;
  box-sizing: border-box;
  background: #fafbfc;
}

/* 账号密码面板：右侧预留眼睛按钮空间 */
#panel-password .form-input {
  padding-right: 40px;
}

.form-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
  background: #fff;
}

.form-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.error-text {
  font-size: 12px;
  color: #ff4d4f;
  margin: 0;
  padding-left: 4px;
}

/* 密码可见性切换 */
.toggle-pwd {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #bfbfbf;
  border-radius: 4px;
}

.toggle-pwd:hover {
  color: #8c8c8c;
}

/* 图形验证码 */
.captcha-input {
  padding-right: 134px;
}

.captcha-img {
  position: absolute;
  right: 6px;
  height: 36px;
  width: 120px;
  border-radius: 6px;
  cursor: pointer;
  object-fit: contain;
  background: #fff;
}

.captcha-placeholder {
  position: absolute;
  right: 6px;
  height: 36px;
  width: 120px;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  background: #f5f5f5;
  color: #8c8c8c;
  font-size: 12px;
  cursor: pointer;
}

/* 记住我 / 忘记密码 */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 只有忘记密码一个入口时（如隐藏了账号密码登录）右对齐，与密码表单保持一致 */
.form-options-solo {
  justify-content: flex-end;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8c8c8c;
  cursor: pointer;
}

.remember-me input {
  cursor: pointer;
}

.forgot-link {
  font-size: 13px;
  color: #1677ff;
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* 提交按钮 */
.submit-btn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 4px;
}

.submit-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(22, 119, 255, 0.4);
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.mini-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(22, 119, 255, 0.3);
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== 区号选择器（SmsLogin.vue）========== */
.phone-with-code {
  padding-left: 110px;
}

.area-code-select {
  position: absolute;
  left: 36px;
  z-index: 10;
}

.area-code-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #1a1a2e;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.area-code-btn:hover:not(:disabled) {
  background: #f0f2f5;
}

.arrow-icon {
  transition: transform 0.2s;
}

.area-code-select.open .arrow-icon {
  transform: rotate(180deg);
}

.area-code-dropdown {
  position: absolute;
  top: 36px;
  left: 0;
  width: 220px;
  max-height: 260px;
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.area-code-search {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.area-code-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  max-height: 200px;
}

.area-code-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
}

.area-code-item:hover {
  background: #f5f7fa;
}

.area-code-item.active {
  background: #f0f5ff;
  color: #1677ff;
}

.country-name {
  color: #333;
}

.area-code-item.active .country-name {
  color: #1677ff;
}

.country-code {
  color: #8c8c8c;
  font-size: 12px;
}

/* 短信验证码输入 */
.code-input {
  padding-right: 120px;
}

.send-code-btn {
  position: absolute;
  right: 6px;
  height: 32px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: #1677ff;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.3s;
}

.send-code-btn:hover:not(:disabled) {
  background: #f0f5ff;
}

.send-code-btn:disabled {
  color: #bfbfbf;
  cursor: not-allowed;
}

/* ========== 钉钉扫码登录（内嵌二维码 DTFrameLogin）========== */
.qrcode-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 20px;
}

/* 扫码方式页签（与表单页签同款；目前仅钉钉，后续可扩展多种扫码方式） */
.qr-methods {
  margin: 0 4px 32px;
}

.dd-qr-box {
  position: relative;
  width: 230px;
  height: 230px;
  margin: 0 auto 16px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

/* 钉钉内嵌 iframe 实际 300x300（含内边距），偏移 (300-230)/2=35px 后只展示居中的二维码区域 */
.dd-frame {
  width: 300px;
  height: 300px;
  position: relative;
  left: -35px;
  top: -35px;
}

.qrcode-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
}

.expired-tip {
  text-align: center;
  padding: 0 16px;
}

.expired-tip p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #8c8c8c;
}

.refresh-btn {
  padding: 6px 16px;
  border: 1px solid #1677ff;
  background: #fff;
  color: #1677ff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.refresh-btn:hover {
  background: #1677ff;
  color: #fff;
}

.qrcode-tip {
  font-size: 14px;
  color: #595959;
  text-align: center;
  margin: 0 0 8px;
}

.qrcode-tip strong {
  color: #1677ff;
}

/* ========== 底部协议（LoginView.vue）========== */
.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
  font-size: 12px;
  color: #bfbfbf;
}

.login-footer a {
  color: #1677ff;
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ========== Toast（toast.ts）========== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 420px;
  word-break: break-all;
  cursor: pointer;
}

.toast-item.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-info {
  background: #f0f5ff;
  border: 1px solid #1677ff;
  color: #1677ff;
}

.toast-success {
  background: #f6ffed;
  border: 1px solid #52c41a;
  color: #389e0d;
}

.toast-warning {
  background: #fffbe6;
  border: 1px solid #faad14;
  color: #d48806;
}

.toast-error {
  background: #fff2f0;
  border: 1px solid #ff4d4f;
  color: #cf1322;
}

/* ========== 密码重置面板 ========== */
.reset-tip {
  text-align: center;
  color: #555;
  font-size: 14px;
  margin: 0 0 16px;
}

.reset-method-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid #d9d9e8;
  border-radius: 6px;
  overflow: hidden;
}

.reset-method-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: #f5f5fa;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-method-tab:first-child {
  border-right: 1px solid #d9d9e8;
}

.reset-method-tab.active {
  background: #4f6ef7;
  color: #fff;
}

.reset-method-tab:hover:not(.active) {
  background: #ebebf3;
}

.back-to-login-link {
  color: #4f6ef7;
  font-size: 13px;
  text-decoration: none;
}

.back-to-login-link:hover {
  text-decoration: underline;
}

/* ========== 响应式（LoginView.vue）========== */
/* 屏幕过小：隐藏左侧背景图，只保留右侧登录 */
@media (max-width: 960px) {
  .login-brand {
    display: none;
  }

  .login-form-area {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    background: linear-gradient(180deg, #fafbff 0%, #eef3fb 100%);
  }
}

@media (max-width: 768px) {
  .login-card {
    max-width: 100%;
    padding: 20px;
  }

  .corner-switch-wrap {
    top: 10px;
    right: 10px;
  }

  .login-footer {
    border-top: none;
    padding-top: 16px;
  }
}

/* ========== 弹窗模式（下游 window.open 打开授权地址，display=popup）========== */
/* 只保留右侧表单卡片：隐藏品牌区（含左下角版权），留白按弹窗窗口尺寸收紧。
   登录方式切换器、钉钉扫码、密码重置等全部保留，仅布局精简 */
.login-page.popup .login-brand {
  display: none;
}

.login-page.popup .login-form-area {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 12px;
  background: linear-gradient(180deg, #fafbff 0%, #eef3fb 100%);
}

.login-page.popup .login-card {
  max-width: 100%;
  padding: 40px 24px 20px;
}

.login-page.popup .login-header {
  margin-bottom: 36px;
}

.login-page.popup .login-footer {
  margin-top: 12px;
  padding-top: 12px;
}
