/*
 * 登录页（/login）专属样式：第三方与密钥登录按钮、右上角扫码折角、二维码面板、图形验证码。
 * 页面骨架见 login.css，与绑定页共用的表单样式见 auth-forms.css。
 *
 * 不内联进 <head> 的原因同 auth-forms.css：<head> 过大会把表单挤出 Tomcat 8KB 响应缓冲区，
 * 渲染到 th:action 时响应已提交，惰性创建 CSRF token 失败，整个页面被截断。
 */

body {
    background: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8)), url('https://cdn.oss.daxiaogroup.com/img/website/login_farm.webp') center/cover no-repeat;
}

/* 第三方登录 */
.social-login {
    margin-top: 24px;
}

.social-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: #9ca3af;
    font-size: 13px;
    white-space: nowrap;
}

.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* 图标按钮排成一排；provider 增加时自动换行，不会把这一行撑破 */
.social-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    background: #fff;
    text-decoration: none;
    box-sizing: border-box;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

/* 悬停描边取各自的品牌色，由按钮上的 --social-brand 提供 */
.social-btn:hover {
    border-color: var(--social-brand, #3370ff);
    background: #f9fafb;
    transform: translateY(-2px);
}

.social-btn--feishu {
    --social-brand: #3370ff;
}

.social-btn--wechat {
    --social-brand: #07c160;
}

/* 密钥登录是 <button> 而非链接，清掉按钮自带的内边距与字体 */
.social-btn--passkey {
    --social-brand: #059669;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.social-btn--passkey:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.social-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* 第三方登录按钮的键盘焦点；Tab 与发码按钮的焦点样式见 auth-forms.css */
.social-btn:focus-visible {
    outline: 2px solid var(--g500, #22c55e);
    outline-offset: 2px;
}

/* 位移只是点缀，用户明确要求减少动效时不该还在动 */
@media (prefers-reduced-motion: reduce) {
    .social-btn {
        transition: border-color 0.2s, background-color 0.2s;
    }

    .social-btn:hover {
        transform: none;
    }
}

/* ---------- 扫码登录：右上角折角 ---------- */
.form-card {
    position: relative;
}

/* 容器本身是整块方形，不接收点击，否则被裁掉的左下半边会挡住下面的 Tab；只有按钮的三角区域可点 */
.qr-corner {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

.qr-corner-btn {
    pointer-events: auto;
}

/* 只露出右上三角：clip-path 同时裁掉点击区域，不会挡住下面 Tab 的点击 */
.qr-corner-btn {
    display: block;
    width: 64px;
    height: 64px;
    padding: 0;
    border: none;
    /* 卡片 1rem 圆角减去 1px 边框 */
    border-top-right-radius: 15px;
    background: var(--emerald-600, #059669);
    color: #fff;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.qr-corner-btn:hover {
    background: var(--emerald-700, #047857);
}

/* clip-path 会把 outline 一起裁掉，键盘焦点改用加深底色 + 内描边表示 */
.qr-corner-btn:focus-visible {
    outline: none;
    background: var(--emerald-700, #047857);
    box-shadow: inset 0 0 0 3px var(--emerald-400, #34d399);
}

/* 图标跨在斜边上，左下一半被切掉，形成「半掩」的效果 */
.qr-corner-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 40px;
    height: 40px;
}

.qr-corner-icon--pc,
.is-qr-mode .qr-corner-icon--qr {
    display: none;
}

.is-qr-mode .qr-corner-icon--pc {
    display: block;
}

.qr-corner-tip {
    position: absolute;
    top: 8px;
    right: 60px;
    padding: 3px 10px;
    border: 1px solid var(--emerald-100, #d1fae5);
    border-radius: 6px;
    background: #fff;
    color: var(--emerald-700, #047857);
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
    pointer-events: none;
}

/* 指向折角的小三角 */
.qr-corner-tip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -5px;
    width: 8px;
    height: 8px;
    border-top: 1px solid var(--emerald-100, #d1fae5);
    border-right: 1px solid var(--emerald-100, #d1fae5);
    background: #fff;
    transform: translateY(-50%) rotate(45deg);
}

/* 两种模式的显隐：表单的 display 由 switchTab 写在行内样式上，这里要用 !important 才压得住 */
.qr-login {
    display: none;
}

.is-qr-mode .qr-login {
    display: block;
}

.is-qr-mode .login-tabs,
.is-qr-mode .form {
    display: none !important;
}

.qr-title {
    margin: 0 0 16px;
    color: var(--slate-900, #0f172a);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.qr-login [hidden] {
    display: none !important;
}

.qr-box {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 8px auto 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.qr-image,
.qr-image svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* 盖在二维码上的各状态提示：加载中、已扫码、已取消、已过期 */
.qr-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.94);
    text-align: center;
}

.qr-overlay-text {
    margin: 0;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
}

.qr-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
}

.qr-overlay-btn {
    padding: 6px 16px;
    border: 1px solid #16a34a;
    border-radius: 999px;
    background: #fff;
    color: #16a34a;
    font-size: 13px;
    cursor: pointer;
}

.qr-overlay-btn:hover {
    background: #f0fdf4;
}

.qr-overlay-btn:focus-visible {
    outline: 2px solid var(--g500, #22c55e);
    outline-offset: 2px;
}

.qr-hint {
    margin: 16px 0 0;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.qr-hint strong {
    color: #16a34a;
    font-weight: 600;
}

/* 图形验证码 */
.captcha-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.captcha-input {
    flex: 1;
}

.captcha-image {
    width: 120px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: opacity 0.2s;
}

.captcha-image:hover {
    opacity: 0.8;
}
