/* =====================================================================
 * SSO 登录页样式（阿里云弹窗风格）
 *
 * 布局说明：
 * - 桌面端为左右两栏卡片：左栏展示 Logo、欢迎语与社交登录入口，
 *   右栏展示登录 tab 与账密表单。
 * - “其他方式登录”在页面中放置两份副本：宽屏显示左栏（Logo 下方）那份，
 *   窄屏（<=640px）隐藏左栏副本并改显表单下方那份，由媒体查询切换。
 * - 通过 <html> 上的 mode-* class 适配三种展示模式：
 *   1. mode-page  ：默认整页模式，视口居中 + 卡片阴影；
 *   2. mode-embed ：iframe 嵌入模式，卡片撑满父容器、去阴影圆角；
 *   3. mode-popup ：window.open 弹窗模式，紧凑布局（取消登录直接关闭窗口）。
 * - 窄屏（<=640px）下自动折叠为单栏，左栏收为顶部横条，
 *   弹窗窗口通常较窄，会自然命中该断点。
 * ===================================================================== */

/* ==================== 主题变量 ==================== */
:root {
    --sso-primary: dodgerblue;          /* 主题色：按钮 / 链接 / focus 边框 */
    --sso-primary-dark: #0077cc;        /* 主题色 hover 态 */
    --sso-text: #212121;                /* 主文字色 */
    --sso-text-secondary: #757575;      /* 次级文字色（标签 / 分隔线文案） */
    --sso-border: #e0e0e0;              /* 输入框边框色 */
    --sso-bg: #f5f5f5;                  /* 整页模式页面背景 */
    --sso-error: #b00020;               /* 错误提示色 */
    --sso-success-text: #2e7d32;        /* 成功提示文字色 */
    --sso-success-bg: #e8f5e9;          /* 成功提示背景色 */
    --sso-success-border: #c8e6c9;      /* 成功提示边框色 */
    --sso-notice-text: #8d6e63;         /* 一般通知文字色 */
    --sso-notice-bg: #fff8e1;           /* 一般通知背景色 */
    --sso-notice-border: #ffe082;       /* 一般通知边框色 */
    --sso-verify: #4CAF50;              /* 滑动验证码按钮色 */
    --sso-verify-dark: #45a049;         /* 滑动验证码按钮 hover 色 */
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--sso-text);
    -webkit-font-smoothing: antialiased;
}

/* ==================== 登录卡片（两栏布局） ==================== */
.login-card {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 820px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ---- 左栏：Logo + 欢迎语 ---- */
.card-aside {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    border-right: 1px solid #f0f0f0;
}

.aside-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
}

.aside-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--sso-text);
}

.aside-slogan {
    font-size: 13px;
    color: var(--sso-text-secondary);
    margin-bottom: 28px;
    text-align: center;
}

/* “其他方式登录”分隔标题：左右两条细线夹文案（位于登录表单下方） */
.social-divider {
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: var(--sso-text-secondary);
    margin-bottom: 16px;
    position: relative;
}

.social-divider::before,
.social-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 24%;
    height: 1px;
    background-color: var(--sso-border);
}

.social-divider::before {
    left: 0;
}

.social-divider::after {
    right: 0;
}

/* ---- 社交登录图标（沿用原 .social-btn 结构，JS 逻辑零改动） ----
 * 页面中存在两份 .social-login 副本：宽屏两栏显示左栏（Logo 下方）那份，
 * 窄屏单栏隐藏左栏副本、改显表单下方副本，由下方媒体查询切换 */
.social-login {
    width: 100%;
    /* 与上方表单错误提示区拉开间距 */
    margin-top: 12px;
}

/* 宽屏两栏（默认）：隐藏右栏表单下方的副本 */
.card-main .social-login {
    display: none;
}

.social-login-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--sso-border);
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.social-btn img {
    width: 30px;
    height: 30px;
}

/* ---- 右栏：tab + 表单 ---- */
.card-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* 内容在剩余高度中垂直居中，与左栏 Logo 的居中对齐，
     * 避免 iframe/弹窗高度大于表单高度时左右两栏上下错位 */
    justify-content: center;
    padding: 32px 36px;
}

/* tab 栏：当前仅“账密登录”一个 tab，保留结构便于后续扩展手机号/通行密钥 */
.tab-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.tab {
    font-size: 16px;
    color: var(--sso-text);
    padding-bottom: 8px;
}

.tab.active {
    color: var(--sso-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--sso-primary);
}

/* tab 栏右侧扩展位（前往注册等） */
.tab-extra {
    margin-left: auto;
    font-size: 14px;
}

/* ---- 盒式输入框：左侧固定 label + 占位提示（阿里云风格） ---- */
.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    height: 44px;
    padding: 0 12px 0 76px;
    font-size: 14px;
    border: 1px solid var(--sso-border);
    border-radius: 4px;
    outline: none;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--sso-primary);
}

.input-group > label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    font-size: 14px;
    color: var(--sso-text);
    pointer-events: none;
}

.input-group input::placeholder {
    color: #b9b9b9;
}

/* ---- 记住我 ---- */
.remember-me-container {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.remember-me-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--sso-primary);
    cursor: pointer;
}

.remember-me-container label {
    margin-left: 8px;
    font-size: 14px;
    color: var(--sso-text-secondary);
    cursor: pointer;
    user-select: none;
}

/* ---- 提示信息 ---- */
.form-error {
    margin-bottom: 12px;
    color: var(--sso-error);
    font-size: 13px;
}

.status-message {
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    padding: 10px 12px;
    text-align: center;
}

.status-message.success {
    background-color: var(--sso-success-bg);
    border: 1px solid var(--sso-success-border);
    color: var(--sso-success-text);
}

.status-message.notice {
    background-color: var(--sso-notice-bg);
    border: 1px solid var(--sso-notice-border);
    color: var(--sso-notice-text);
}

/* ---- 滑动验证码按钮（TAC 组件触发入口） ---- */
.captcha-container {
    margin-bottom: 16px;
}

.verify-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--sso-verify);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
}

.verify-btn:hover:not(:disabled) {
    background-color: var(--sso-verify-dark);
}

.verify-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* ---- 登录按钮 ---- */
.submit-btn {
    width: 100%;
    padding: 13px;
    background-color: var(--sso-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn:hover:not(:disabled) {
    background-color: var(--sso-primary-dark);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ---- 底部链接行 ---- */
.links-container {
    display: flex;
    justify-content: flex-start;
    gap: 24px;
    margin-top: 16px;
    font-size: 14px;
}

.link {
    color: var(--sso-primary);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.link:hover {
    color: var(--sso-primary-dark);
    text-decoration: underline;
}

/* ---- 表单级错误提示（JS 校验输出） ---- */
.error-message {
    color: var(--sso-error);
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    min-height: 18px;
}

/* ==================== 模式适配 ==================== */

/* 整页模式（默认）：视口居中 + 灰色背景 */
html.mode-page body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: var(--sso-bg);
}

/* 嵌入模式（iframe）：撑满父容器，去掉阴影圆角与外边距 */
html.mode-embed body {
    min-height: 100vh;
    background-color: #fff;
}

html.mode-embed .login-card {
    max-width: none;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
}

/* 弹窗模式（window.open）：白底紧凑布局，取消登录由用户直接关闭窗口 */
html.mode-popup body {
    min-height: 100vh;
    background-color: #fff;
}

html.mode-popup .login-card {
    max-width: 640px;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    margin: 0 auto;
}

html.mode-popup .card-aside {
    padding: 24px 20px;
}

html.mode-popup .card-main {
    padding: 24px 28px;
}

/* ==================== 响应式：窄屏折叠单栏 ==================== */
@media (max-width: 640px) {
    /* 两栏改为上下结构：左栏收为顶部横条 */
    .login-card {
        flex-direction: column;
    }

    .card-aside {
        flex: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 16px 20px;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .aside-logo {
        width: 36px;
        height: 36px;
        margin-bottom: 0;
    }

    .aside-title {
        font-size: 20px;
        margin-bottom: 0;
    }

    .aside-slogan {
        display: none;
    }

    /* 窄屏单栏：隐藏左栏社交入口，改显表单下方的副本 */
    .card-aside .social-login {
        display: none;
    }

    .card-main .social-login {
        display: block;
    }

    .card-main {
        padding: 24px 20px;
    }

    /* 表单下方的其他登录方式：窄屏下图标缩小 */
    .social-btn {
        width: 36px;
        height: 36px;
    }

    .social-btn img {
        width: 24px;
        height: 24px;
    }
}
