/**
 * APE主题 - 认证页面样式
 * 登录/注册/找回密码页面通用样式
 */

/* ============ 认证页面主题变量 ============ */
:root {
    --auth-primary: #006eff;
    --auth-primary-light: #3385ff;
    --auth-primary-dark: #0052cc;
    --auth-primary-darker: #004bb8;
    --auth-primary-bg: #e6f0ff;
    --auth-primary-shadow: rgba(0,110,255,0.15);
    --auth-primary-shadow-hover: rgba(0,110,255,0.4);
    --auth-primary-shadow-oauth: rgba(0,110,255,0.2);
    --auth-primary-disabled: #99c2ff;
    --auth-gradient: linear-gradient(135deg, #006eff 0%, #3385ff 100%);
    --auth-gradient-hover: linear-gradient(135deg, #0052cc 0%, #0066e6 100%);
    --auth-gradient-active: linear-gradient(135deg, #004bb8 0%, #005fd4 100%);
    --auth-bg-gradient: linear-gradient(135deg, #006eff 0%, #004bb8 100%);
}

/* ============ 页面容器 ============ */
.ape-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg-gradient);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.ape-auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: apeAuthBgRotate 30s linear infinite;
}

@keyframes apeAuthBgRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============ 卡片容器 ============ */
.ape-auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 440px;
    padding: 40px 36px;
    position: relative;
    z-index: 1;
}

.ape-auth-card-wide {
    max-width: 520px;
}

/* ============ Logo和标题 ============ */
.ape-auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.ape-auth-logo img {
    max-height: 48px;
    max-width: 180px;
    object-fit: contain;
}

.ape-auth-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #303133;
    margin: 0 0 8px;
}

.ape-auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: #909399;
    margin: 0 0 28px;
}

/* ============ Tab切换 ============ */
.ape-auth-tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 24px;
}

.ape-auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 15px;
    color: #909399;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
    user-select: none;
}

.ape-auth-tab:hover {
    color: var(--auth-primary);
}

.ape-auth-tab.active {
    color: var(--auth-primary);
    border-bottom-color: var(--auth-primary);
    font-weight: 500;
}

.ape-auth-tab-content {
    display: none;
}

.ape-auth-tab-content.active {
    display: block;
}

/* ============ 表单 ============ */
.ape-auth-form {
    margin-top: 0;
}

.ape-auth-form-group {
    margin-bottom: 18px;
    position: relative;
}

.ape-auth-form-group label {
    display: block;
    font-size: 14px;
    color: #606266;
    margin-bottom: 6px;
    font-weight: 500;
}

.ape-auth-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.3s;
    background: #fff;
}

.ape-auth-input-group:focus-within {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 2px var(--auth-primary-shadow);
}

.ape-auth-input-group .ape-auth-input-prefix {
    padding: 0 12px;
    color: #909399;
    font-size: 14px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    background: #f5f7fa;
    border-right: 1px solid #dcdfe6;
    height: 42px;
}

.ape-auth-input-group input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-size: 14px;
    color: #303133;
    height: 42px;
    box-sizing: border-box;
    min-width: 0;
}

.ape-auth-input-group input::placeholder {
    color: #c0c4cc;
}

.ape-auth-input-group .ape-auth-input-suffix {
    padding: 0 12px;
    color: #909399;
    font-size: 14px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
}

.ape-auth-input-group .ape-auth-input-suffix:hover {
    color: var(--auth-primary);
}

/* 国家区号选择 */
.ape-auth-country-select {
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    color: #303133;
    height: 42px;
    background: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23909399' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    max-width: 120px;
}

.ape-auth-country-select:focus {
    border-color: var(--auth-primary);
}

.ape-auth-phone-row {
    display: flex;
    gap: 8px;
}

.ape-auth-phone-row .ape-auth-country-select {
    flex-shrink: 0;
    width: 120px;
}

.ape-auth-phone-row .ape-auth-input-group {
    flex: 1;
}

/* 验证码输入行 */
.ape-auth-code-row {
    display: flex;
    gap: 8px;
}

.ape-auth-code-row .ape-auth-input-group {
    flex: 1;
}

.ape-auth-code-row .ape-auth-send-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============ 按钮 ============ */
.ape-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    outline: none;
    font-weight: 500;
    user-select: none;
}

.ape-auth-btn-primary {
    background: var(--auth-gradient);
    color: #fff;
    width: 100%;
    height: 44px;
    font-size: 16px;
}

.ape-auth-btn-primary:hover {
    background: var(--auth-gradient-hover);
    box-shadow: 0 4px 12px var(--auth-primary-shadow-hover);
}

.ape-auth-btn-primary:active {
    background: var(--auth-gradient-active);
}

.ape-auth-btn-primary:disabled {
    background: var(--auth-primary-disabled);
    cursor: not-allowed;
    box-shadow: none;
}

.ape-auth-btn-text {
    background: none;
    color: var(--auth-primary);
    padding: 4px 0;
    font-size: 13px;
}

.ape-auth-btn-text:hover {
    color: var(--auth-primary-light);
}

.ape-auth-btn-text:disabled {
    color: #c0c4cc;
    cursor: not-allowed;
}

.ape-auth-send-btn {
    height: 42px;
    padding: 0 16px;
    background: var(--auth-primary-bg);
    color: var(--auth-primary);
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.ape-auth-send-btn:hover:not(:disabled) {
    background: var(--auth-primary);
    color: #fff;
    border-color: var(--auth-primary);
}

.ape-auth-send-btn:disabled {
    color: #c0c4cc;
    cursor: not-allowed;
    background: #f5f7fa;
}

/* ============ 验证码容器 ============ */
.ape-auth-captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ape-auth-captcha-row .ape-auth-input-group {
    flex: 1;
}

.ape-auth-captcha-img {
    flex-shrink: 0;
    height: 42px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #dcdfe6;
}

.ape-auth-captcha-container {
    margin-bottom: 18px;
}

/* ============ 复选框 ============ */
.ape-auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #606266;
    cursor: pointer;
    user-select: none;
}

.ape-auth-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--auth-primary);
}

.ape-auth-checkbox a {
    color: var(--auth-primary);
    text-decoration: none;
}

.ape-auth-checkbox a:hover {
    text-decoration: underline;
}

/* ============ 表单底部 ============ */
.ape-auth-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 13px;
}

.ape-auth-form-footer a {
    color: var(--auth-primary);
    text-decoration: none;
}

.ape-auth-form-footer a:hover {
    text-decoration: underline;
}

/* ============ 错误提示 ============ */
.ape-auth-error {
    background: #fef0f0;
    color: #f56c6c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

.ape-auth-error.show {
    display: flex;
}

.ape-auth-error svg {
    flex-shrink: 0;
}

/* ============ 成功提示 ============ */
.ape-auth-success {
    background: #f0f9eb;
    color: #67c23a;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

.ape-auth-success.show {
    display: flex;
}

/* ============ OAuth三方登录 ============ */
.ape-auth-oauth {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.ape-auth-oauth-title {
    text-align: center;
    font-size: 13px;
    color: #909399;
    margin-bottom: 16px;
    position: relative;
}

.ape-auth-oauth-title::before,
.ape-auth-oauth-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: #f0f0f0;
}

.ape-auth-oauth-title::before { left: 0; }
.ape-auth-oauth-title::after { right: 0; }

.ape-auth-oauth-list {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.ape-auth-oauth-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e4e7ed;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    overflow: hidden;
}

.ape-auth-oauth-item:hover {
    border-color: var(--auth-primary);
    box-shadow: 0 2px 8px var(--auth-primary-shadow-oauth);
    transform: translateY(-2px);
}

.ape-auth-oauth-item img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* ============ 密码可见切换 ============ */
.ape-auth-pwd-toggle {
    padding: 0 12px;
    cursor: pointer;
    color: #909399;
    display: flex;
    align-items: center;
}

.ape-auth-pwd-toggle:hover {
    color: var(--auth-primary);
}

/* ============ 安全验证弹窗 ============ */
.ape-auth-security-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ape-auth-security-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    min-width: 380px;
    max-width: 440px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.ape-auth-security-title {
    font-size: 18px;
    font-weight: 600;
    color: #303133;
    margin: 0 0 8px;
}

.ape-auth-security-desc {
    font-size: 14px;
    color: #909399;
    margin: 0 0 20px;
}

.ape-auth-security-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.ape-auth-security-method:hover {
    border-color: var(--auth-primary);
    background: var(--auth-primary-bg);
}

.ape-auth-security-method.selected {
    border-color: var(--auth-primary);
    background: var(--auth-primary-bg);
}

.ape-auth-security-method svg {
    flex-shrink: 0;
    color: var(--auth-primary);
}

.ape-auth-security-method span {
    font-size: 14px;
    color: #303133;
}

/* ============ 加载状态 ============ */
.ape-auth-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: apeAuthSpin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.ape-auth-loading-dark {
    border-color: rgba(64,158,255,0.2);
    border-top-color: var(--auth-primary);
}

@keyframes apeAuthSpin {
    to { transform: rotate(360deg); }
}

/* ============ 响应式 ============ */
@media (max-width: 480px) {
    .ape-auth-card {
        padding: 28px 20px;
        border-radius: 8px;
    }

    .ape-auth-title {
        font-size: 20px;
    }

    .ape-auth-phone-row {
        flex-direction: column;
    }

    .ape-auth-phone-row .ape-auth-country-select {
        width: 100%;
    }

    .ape-auth-security-dialog {
        min-width: auto;
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* ============ 协议弹窗 ============ */
.ape-auth-agreement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ape-auth-agreement-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.ape-auth-agreement-dialog h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #303133;
}

.ape-auth-agreement-dialog .ape-auth-agreement-content {
    font-size: 14px;
    color: #606266;
    line-height: 1.8;
}

.ape-auth-agreement-dialog .ape-auth-agreement-close {
    margin-top: 20px;
    text-align: center;
}
/* ===== captchafix v1 (2026-10-01): TPCaptcha 滑块 桌面端正常渲染 ===== */
/* 魔方 /console/v1/captcha 返回的 .captcha-content 是移动端 rem 样式且 position:fixed，
   在桌面登录/注册页会缩小并悬浮在表单中间 -> 强制相对定位并放到表单内、放大到桌面尺寸 */
.ape-auth-captcha-container { display: block; margin: 6px 0 16px; }
.ape-auth-captcha-container .captcha-content {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 360px !important;
  box-sizing: border-box;
  padding: 12px 14px !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.06) !important;
}
.ape-auth-captcha-container .captcha-title {
  font-size: 13px !important;
  line-height: 18px !important;
  color: #606266 !important;
  margin-bottom: 8px !important;
}
.ape-auth-captcha-container #captcha-img {
  width: 96px !important;
  height: 34px !important;
  border-radius: 4px !important;
}
.ape-auth-captcha-container #captcha-input {
  width: 150px !important;
  height: 34px !important;
  font-size: 13px !important;
  border: 1px solid #dcdfe6 !important;
  border-radius: 4px !important;
  padding: 0 8px !important;
  box-sizing: border-box;
  margin-right: 6px !important;
}
.ape-auth-captcha-container #check-btn,
.ape-auth-captcha-container #cancel-btn {
  width: 56px !important;
  height: 34px !important;
  font-size: 13px !important;
  border-radius: 4px !important;
  margin: 0 !important;
  cursor: pointer;
}
.ape-auth-captcha-container .captcha-footer {
  flex-direction: row !important;
  justify-content: flex-end !important;
  margin-top: 10px !important;
}
@media (max-width: 560px) {
  .ape-auth-captcha-container #captcha-input { width: 100% !important; margin: 0 0 8px !important; }
  .ape-auth-captcha-container #captcha-img { width: 120px !important; height: 42px !important; }
  .ape-auth-captcha-container #check-btn,
  .ape-auth-captcha-container #cancel-btn { width: 100% !important; height: 38px !important; margin: 4px 0 0 !important; }
  .ape-auth-captcha-container .captcha-footer { flex-direction: column !important; }
}

/* ===== captchafix v2 (2026-10-01): 高优先级覆盖内联 fixed/rem 图形验证码 ===== */
#apeLoginEmailCaptcha .captcha-content,
#apeLoginPhoneCaptcha .captcha-content,
#apeRegPhoneCaptcha .captcha-content,
#apeRegEmailCaptcha .captcha-content {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  margin: 0 auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 340px !important;
  box-sizing: border-box;
  padding: 12px 14px !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,.08) !important;
  opacity: 1 !important;
}
#apeLoginEmailCaptcha .captcha-title,
#apeLoginPhoneCaptcha .captcha-title,
#apeRegPhoneCaptcha .captcha-title,
#apeRegEmailCaptcha .captcha-title {
  font-size: 13px !important;
  line-height: 18px !important;
  color: #303133 !important;
  margin-bottom: 8px !important;
}
.ape-auth-captcha-container #captcha-img,
#apeLoginEmailCaptcha #captcha-img,
#apeLoginPhoneCaptcha #captcha-img {
  width: 96px !important;
  height: 34px !important;
  border-radius: 4px !important;
  display: block !important;
}
.ape-auth-captcha-container #captcha-input,
#apeLoginEmailCaptcha #captcha-input,
#apeLoginPhoneCaptcha #captcha-input {
  width: 150px !important;
  height: 34px !important;
  font-size: 13px !important;
  border: 1px solid #dcdfe6 !important;
  border-radius: 4px !important;
  padding: 0 8px !important;
  box-sizing: border-box;
  margin-right: 6px !important;
}
.ape-auth-captcha-container #check-btn,
.ape-auth-captcha-container #cancel-btn,
#apeLoginEmailCaptcha #check-btn, #apeLoginEmailCaptcha #cancel-btn,
#apeLoginPhoneCaptcha #check-btn, #apeLoginPhoneCaptcha #cancel-btn {
  width: 56px !important;
  height: 34px !important;
  font-size: 13px !important;
  border-radius: 4px !important;
  margin: 0 0 0 4px !important;
  cursor: pointer;
  white-space: nowrap;
}
.ape-auth-captcha-container .captcha-footer,
#apeLoginEmailCaptcha .captcha-footer, #apeLoginPhoneCaptcha .captcha-footer {
  flex-direction: row !important;
  justify-content: flex-end !important;
  margin-top: 10px !important;
}

/* ===== captchafix v3 (2026-10-01): 修图形验证码图片被竖向压成一条线 ===== */
/* 魔方 /console/v1/captcha 源图为超宽条(约1268x45, 28:1)。默认 object-fit:fill 会把
   宽条竖向拉伸 -> 数字糊成波浪线。改为 cover 定盒白底描边，显示居中可读一段。 */
#apeLoginEmailCaptcha #captcha-img,
#apeLoginPhoneCaptcha #captcha-img,
#apeRegPhoneCaptcha #captcha-img,
#apeRegEmailCaptcha #captcha-img,
.ape-auth-captcha-container #captcha-img {
  width: 112px !important;
  height: 40px !important;
  object-fit: cover !important;
  display: block !important;
  background: #fff !important;
  border: 1px solid #dcdfe6 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
}
