/* ============================================================
 * 模板4 私有样式 — login-tpl4.css
 * 2026-10-15 Step1 自 loginTemplateView4.html 片段内 <style> 原样迁出（逐字节保留，仅加本头注释）。
 * 由 casLoginView.html <head> 按 loginTemplateId == 'tpl4' 条件加载（置于 login-core.css 之后，层叠顺序与迁出前一致）。
 * ============================================================ */

        /* 辅助按钮默认显隐（与模板1/2/3 同源） */
        .account-activate-entry { display: none; }
        .account-activate-entry.active { display: inline; }

        /* ========== 根容器（左窄竖栏 + 右主体） ========== */
        .tpl4-frame {
            position: relative;
            width: 100%;
            min-height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: row;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background: linear-gradient(160deg, #f1f5fe 0%, #f8fafd 40%, #f2f4ff 100%);
        }
        .tpl4-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }

        /* ========== 左侧窄竖栏 ========== */
        .tpl4-rail {
            position: relative; z-index: 2;
            flex-shrink: 0;
            width: 92px;
            display: flex; flex-direction: column; align-items: center;
            padding: 30px 0 24px;
            color: #fff;
            background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
            animation: tpl4RailIn .6s ease-out both;
        }
        @keyframes tpl4RailIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
        /* 背景图模式下：竖栏改为磨砂暗栏（与 Vue 预览一致） */
        .tpl4-frame.with-bg .tpl4-rail {
            background: rgba(15, 23, 42, .5);
            backdrop-filter: blur(10px);
        }
        .tpl4-rail-logo {
            width: 68px; height: 68px; border-radius: 18px;
            background: rgba(255, 255, 255, .16);
            display: flex; align-items: center; justify-content: center;
            padding: 9px; box-sizing: border-box; flex-shrink: 0;
        }
        /* 长矩形 LOGO：加宽矮容器，避免被强制裁成方形（与 Vue 预览一致） */
        .tpl4-rail-logo.is-wide { width: 84px; height: 46px; border-radius: 12px; padding: 7px 9px; }
        .tpl4-rail-logo img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
        .tpl4-rail-logo-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; }
        .tpl4-rail-logo-ph svg { width: 30px; height: 30px; }
        .tpl4-rail-line { width: 36px; height: 2px; background: rgba(255, 255, 255, .5); margin-top: 18px; }
        /* 竖排校名 */
        .tpl4-rail-title {
            margin-top: 20px;
            writing-mode: vertical-rl; text-orientation: upright;
            font-size: 24px; font-weight: 800; letter-spacing: 10px; line-height: 1.15;
            text-shadow: 0 2px 10px rgba(0, 0, 0, .12);
        }
        .tpl4-rail-sub {
            margin-top: 14px;
            writing-mode: vertical-rl; letter-spacing: 4px;
            font-size: 16px; opacity: .82;
        }

        /* ========== 右侧主体 ========== */
        .tpl4-main { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; flex-direction: column; }
        .tpl4-body { flex: 1; min-height: 0; display: flex; }
        .tpl4-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

        /* ========== 登录卡片 ========== */
        .tpl4-card {
            position: relative; z-index: 1;
            width: 460px; max-width: 92%;
            padding: 38px 44px 26px;
            background: #fff;
            border-radius: 20px;
            box-shadow: 0 24px 70px rgba(59, 130, 246, .14), 0 4px 18px rgba(15, 23, 42, .06);
            display: flex; flex-direction: column;
            min-height: 520px;
            animation: tpl4CardIn .7s ease-out both;
        }
        @keyframes tpl4CardIn { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }
        /* 背景图模式下卡片为磨砂白（与 Vue 预览一致） */
        .tpl4-frame.with-bg .tpl4-card { background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); }

        .tpl4-welcome { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 22px; letter-spacing: .5px; text-align: center; }

        /* 纯图标方式切换（与 Vue 预览一致） */
        .tpl4-tabs { display: flex; justify-content: center; gap: 18px; margin-bottom: 26px; }
        .tpl4-tab {
            width: 46px; height: 46px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            background: #f1f5f9; border: 1.5px solid transparent; color: #64748b;
            cursor: pointer; transition: all .25s ease;
        }
        .tpl4-tab svg { width: 20px; height: 20px; }
        .tpl4-tab:hover { color: #475569; background: #e9eef5; }
        .tpl4-tab.is-active {
            background: var(--primary); color: #fff; border-color: var(--primary);
            box-shadow: 0 4px 14px rgba(22, 119, 255, .3); transform: translateY(-2px);
        }

        /* 自适应输入区：仅此区域随登录方式高度变化（与 Vue 预览一致） */
        .tpl4-form-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-start; }

        /* 表单字段（类名前缀改 tpl4，逻辑与模板1/2/3 同源） */
        .tpl4-form { min-height: 0; }
        .tpl4-form-qr { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; }
        .tpl4-form-hint { display: flex; align-items: center; gap: 6px; margin: 0 0 18px; padding: 14px 16px; min-height: 48px; box-sizing: border-box; font-size: 13px; line-height: 1.5; color: var(--primary-dark); background: var(--primary-light); border: 1px solid var(--primary); border-radius: 10px; }
        .tpl4-form-hint svg { flex-shrink: 0; width: 15px; height: 15px; color: var(--primary); }
        .tpl4-field, .tpl4-field-code { position: relative; display: flex; align-items: center; margin-bottom: 16px; }
        .tpl4-field input, .tpl4-field-code input {
            width: 100%; padding: 14px 14px 14px 44px; border: 1.5px solid #e2e8f0; border-radius: 12px;
            font-size: 14px; color: #1e293b; outline: none; background: #fafbfc; transition: all .25s ease; box-sizing: border-box;
        }
        .tpl4-field input::placeholder, .tpl4-field-code input::placeholder { color: #94a3b8; }
        .tpl4-field input:focus, .tpl4-field-code input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-light); }
        .tpl4-field-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: #94a3b8; pointer-events: none; transition: color .25s; }
        .tpl4-field input:focus ~ .tpl4-field-icon, .tpl4-field-code input:focus ~ .tpl4-field-icon { color: var(--primary); }
        /* 密码显隐图标：固定尺寸 + 内边距，保证热区足够大；
           旧实现是 19×16 的纯字体图标（无 padding），字体图标一旦未加载，元素会塌缩成 0×0，点击根本不命中 */
        .tpl4-pwd-toggle {
            position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
            width: 20px; height: 20px; padding: 7px; box-sizing: content-box;
            display: flex; align-items: center; justify-content: center;
            font-size: 16px; line-height: 1; color: #94a3b8; cursor: pointer; z-index: 2; transition: color .2s;
        }
        .tpl4-pwd-toggle:hover, .tpl4-pwd-toggle:focus-visible { color: var(--primary); }
        .tpl4-pwd-toggle:focus-visible { outline: none; }
        /* 密码框右侧预留图标空间，避免明文与图标重叠 */
        .tpl4-field input[type="password"] { padding-right: 46px; }
        .tpl4-code-btn { flex-shrink: 0; margin-left: 10px; padding: 0 18px; height: 44px; background: #fff; border: 1.5px solid var(--primary); color: var(--primary); border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; transition: all .2s; }
        .tpl4-code-btn:hover { background: var(--primary); color: #fff; }
        .tpl4-captcha { flex-shrink: 0; margin-left: 10px; min-width: 96px; height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: center; font-family: 'SF Mono', 'Monaco', 'Consolas', monospace; font-size: 16px; font-weight: 600; color: #475569; background: linear-gradient(135deg, #f8fafc, #f1f5f9); border: 1.5px solid #e2e8f0; border-radius: 12px; cursor: pointer; user-select: none; transition: border-color .2s; }
        .tpl4-captcha:hover { border-color: var(--primary); }
        .tpl4-login-btn { width: 100%; padding: 14px 0; margin-top: 6px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; color: #fff; cursor: pointer; letter-spacing: 6px; transition: transform .2s, box-shadow .2s; box-shadow: 0 6px 20px rgba(22, 119, 255, .25); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
        .tpl4-login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(22, 119, 255, .32); }

        /* 错误提示 */
        .tpl4-error { display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 8px; margin-bottom: 16px; padding: 10px 12px; font-size: 13px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; }
        .tpl4-error > i, .tpl4-error > svg { flex: 0 0 auto; font-size: 16px; line-height: 1; color: #ef4444; width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
        .tpl4-error > span { flex: 1 1 auto; white-space: nowrap; line-height: 1.2; }

        /* ========== 自定义确认弹窗（与模板1/2/3 同源，置于 .tpl4-card 之外） ========== */
        .confirm-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.45); z-index: 9999;
            display: none; justify-content: center; align-items: center;
        }
        .confirm-overlay.show { display: flex; }
        .confirm-dialog {
            background: #fff; border-radius: 12px; width: 400px; max-width: 92%;
            padding: 28px 28px 20px; text-align: center;
            box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
            animation: confirmPopIn .18s ease-out;
        }
        @keyframes confirmPopIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
        .confirm-icon {
            width: 52px; height: 52px; margin: 0 auto 16px;
            border-radius: 50%; background: #fff7e6;
            display: flex; align-items: center; justify-content: center;
            font-size: 28px; color: #fa8c16;
        }
        .confirm-title { font-size: 16px; font-weight: 600; color: #1f2937; margin-bottom: 8px; }
        .confirm-message { font-size: 14px; color: #6b7280; margin-bottom: 28px; line-height: 1.6; }
        .confirm-buttons { display: flex; gap: 10px; justify-content: center; }
        .confirm-btn { flex: 1; max-width: 120px; padding: 10px 0; border-radius: 8px; border: none; font-size: 14px; cursor: pointer; transition: all 0.2s; }
        .confirm-btn-no { background: #f3f4f6; color: #374151; }
        .confirm-btn-no:hover { background: #e5e7eb; }
        .confirm-btn-yes { background: #1677ff; color: #fff; }
        .confirm-btn-yes:hover { background: #4096ff; }

        /* 卡片底部链接（与模板1/2/3 同源：真实 /oauth/* + 配置驱动显隐） */
        .tpl4-links { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 18px; border-top: 1px solid rgba(148, 163, 184, .15); }
        .tpl4-links a { font-size: 13px; color: var(--primary-dark); text-decoration: none; transition: color .2s; white-space: nowrap; }
        .tpl4-links a:hover { color: var(--primary); }
        .tpl4-links.is-qr .change-phone-entry { display: none !important; }

        /* ========== 扫码面板（与模板1/2/3 同源真实渲染；无扫描线，对齐你此前的反馈） ========== */
        .tpl4-qr-section { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; animation: tpl4QrSlideIn .3s ease-out both; }
        @keyframes tpl4QrSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
        .tpl4-qr-box {
            position: relative; width: 170px; height: 170px; background: #fff; border-radius: 16px;
            display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden;
            padding: 0; box-sizing: border-box; border: 1.5px solid var(--primary);
            box-shadow: 0 10px 30px rgba(22, 119, 255, .14); transition: box-shadow .25s, transform .25s;
        }
        .tpl4-qr-box:hover { box-shadow: 0 14px 36px rgba(22, 119, 255, .22); transform: translateY(-2px); }
        .tpl4-qr-box img { width: 100%; height: 100%; border-radius: 14px; background: #fff; box-sizing: border-box; padding: 14px; object-fit: contain; }
        .tpl4-qr-placeholder { text-align: center; color: #64748b; }
        .tpl4-qr-placeholder svg { width: 64px; height: 64px; margin-bottom: 8px; color: #94a3b8; }
        .tpl4-qr-loading { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(255, 255, 255, .9); }
        .tpl4-qr-loading.show { display: flex; }
        .tpl4-qr-loading::after { content: ''; width: 28px; height: 28px; border: 3px solid rgba(148, 163, 184, .25); border-top-color: var(--primary); border-radius: 50%; animation: tpl4Spin 1s linear infinite; }
        @keyframes tpl4Spin { to { transform: rotate(360deg); } }
        .tpl4-qr-overlay { position: absolute; inset: 0; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; border-radius: 16px; z-index: 5; }
        .tpl4-qr-overlay.show { display: flex; }
        .tpl4-qr-overlay-inner { text-align: center; }
        .tpl4-qr-check { font-size: 40px; color: #10b981; margin-bottom: 6px; }
        .tpl4-qr-check-text { font-size: 15px; font-weight: 600; color: #1f2937; }
        .tpl4-qr-check-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
        /* .tpl4-qr-status / -text / -icon 已于 2026-09-30 全部删除：
           企微与钉钉两个面板的「二维码状态指示器」均已移除，不再有任何元素使用这些类。 */
        .tpl4-qr-tip { font-size: 13px; color: #64748b; margin: 18px 0 12px; text-align: center; }
        .tpl4-qr-refresh { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-light); border: none; color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 16px; border-radius: 8px; transition: background .2s, box-shadow .2s; }
        .tpl4-qr-refresh svg { width: 14px; height: 14px; }
        .tpl4-qr-refresh:hover { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(22, 119, 255, .25); }

        /* ========== 底部安全 / 版权条（右栏下方，与 Vue 预览一致） ========== */
        .tpl4-footbar {
            position: relative; z-index: 2; flex-shrink: 0;
            padding: 26px 20px 24px; text-align: center;
            background: transparent; border: none;
        }
        .tpl4-secret { color: #dc2626; font-size: 13px; letter-spacing: .5px; }
        .tpl4-frame.with-bg .tpl4-secret { color: #f87171; }
        .tpl4-copyright { margin-top: 6px; }
        .tpl4-copyright-line { margin: 0; font-size: 12px; color: #94a3b8; line-height: 1.9; }
        .tpl4-frame.with-bg .tpl4-copyright-line { color: rgba(255, 255, 255, .75); }

        /* 响应式：窄屏竖栏收窄、卡片收窄（与 Vue 预览一致） */
        @media (max-width: 720px) {
            .tpl4-rail { width: 64px; padding: 22px 0 18px; }
            .tpl4-rail-logo { width: 52px; height: 52px; border-radius: 14px; padding: 7px; }
            .tpl4-rail-logo.is-wide { width: 56px; height: 32px; border-radius: 10px; padding: 5px 7px; }
            .tpl4-rail-title { font-size: 20px; letter-spacing: 8px; }
            .tpl4-card { width: 92%; padding: 30px 24px 22px; }
        }

        /* ========== 企业微信账号绑定（与模板2 同源功能；样式按本模板主题色适配） ========== */
        .wxbind-prompt { display: none; margin: 0 0 18px; padding: 16px; box-sizing: border-box; border-radius: 12px; background: var(--primary-light); border: 1px solid var(--primary); }
        .wxbind-prompt-head { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
        .wxbind-prompt-head i { color: var(--primary); }
        .wxbind-prompt-text { margin: 0 0 12px; font-size: 13px; color: var(--primary-dark); }
        .wxbind-openid-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; color: var(--primary-dark); background: #fff; border: 1px solid var(--primary); border-radius: 10px; overflow-wrap: anywhere; }
        .wxbind-openid-card i { color: var(--primary); flex-shrink: 0; }
        .wxbind-openid-card .openid-display { font-weight: 600; }
        .error-message { color: #ef4444; font-size: 13px; margin: 6px 0 0; display: flex; align-items: center; gap: 4px; }
        .success-message { color: #10b981; font-size: 13px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 4px; }
        .wxbind-status { text-align: center; margin-top: 4px; }
        #bindingSubmitBtn:disabled { opacity: .6; cursor: not-allowed; }
        .wxbind-cancel { width: 100%; margin-top: 12px; padding: 12px 0; background: #fff; color: #64748b; border: 1.5px solid #e2e8f0; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; letter-spacing: 2px; transition: all .2s; }
        .wxbind-cancel:hover { color: var(--primary); border-color: var(--primary); }
        @keyframes wxbindFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
        #wechatBinding.wechat-binding-fade-in { animation: wxbindFadeIn .4s ease; }
