/* ============================================================
 * login.css - 家广福微系统登录页样式
 * 规则：移动端自适应、不出现横向/竖向滚动条但保持滚动效果
 *      禁止固定像素宽度、禁止内联 width:xxxpx
 * ============================================================ */

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #1565c0;
    --primary-dark: #0d47a1;
    --primary-light: #42a5f5;
    --primary-lighter: #90caf9;
    --accent: #1e88e5;
    --danger: #e53935;
    --success: #43a047;
    --text-main: #2c3e50;
    --text-sub: #7f8c8d;
    --text-muted: #95a5a6;
    --bg-brand-start: #0d47a1;
    --bg-brand-mid: #1565c0;
    --bg-brand-end: #1976d2;
    --bg-form: #f5f7fa;
    --input-bg: #f8fafc;
    --input-border: #e0e6ed;
    --radius: clamp(8px, 2.5vw, 14px);
    --input-h: clamp(46px, 12vw, 52px);
    font-size: 16px;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg-form);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* ---------- 登录容器 ---------- */
.login-container {
    height: 100%;
    height: 100dvh; /* 移动端动态视口，避免地址栏/WebView 导致高度异常 */
    width: 100%;
    display: flex;
    position: relative;
}

/* ============================================================
 * 移动端布局（默认）
 * ============================================================ */
.brand-pane {
    display: none; /* 移动端隐藏品牌面板 */
}

.form-pane {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(20px, 6vw, 40px) clamp(20px, 6vw, 36px);
    background: linear-gradient(180deg, var(--bg-brand-start) 0%, var(--bg-brand-mid) 45%, var(--bg-form) 45%, var(--bg-form) 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.form-pane::-webkit-scrollbar {
    display: none;
}

.form-inner {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    margin: auto; /* 自动吸收剩余空间，实现垂直居中；内容溢出时可正常滚动不被截断 */
}

/* 表单头部 */
.form-header {
    text-align: center;
    margin-bottom: clamp(16px, 5vw, 24px);
}

.form-title {
    font-size: clamp(22px, 6vw, 28px);
    font-weight: 700;
    color: #fff;
    margin-bottom: clamp(4px, 1.5vw, 6px);
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.form-subtitle {
    font-size: clamp(12px, 3.5vw, 14px);
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 1px;
}

/* 移动端表单卡片 */
.login-form {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius);
    padding: clamp(20px, 6vw, 28px) clamp(16px, 5vw, 24px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

/* 浮动标签输入框 */
.form-item {
    position: relative;
    margin-bottom: clamp(14px, 4.5vw, 20px);
}

.form-item input {
    width: 100%;
    height: var(--input-h);
    border: 2px solid var(--input-border);
    border-radius: clamp(6px, 2vw, 10px);
    background: var(--input-bg);
    font-size: clamp(15px, 4.2vw, 16px);
    color: var(--text-main);
    padding: 0 clamp(40px, 11vw, 48px) 0 clamp(40px, 11vw, 48px);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-item input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}

.form-item label {
    position: absolute;
    left: clamp(40px, 11vw, 48px);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    font-size: clamp(14px, 4vw, 15px);
    pointer-events: none;
    transition: all 0.18s ease;
    background: transparent;
    padding: 0 4px;
}

.form-item.has-val label,
.form-item input:focus + label {
    top: 0;
    transform: translateY(-50%) scale(0.85);
    left: clamp(12px, 3.5vw, 16px);
    background: #fff;
    color: var(--accent);
}

/* 左侧图标 */
.form-item .icon {
    position: absolute;
    left: clamp(12px, 3.5vw, 16px);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(20px, 5.5vw, 22px);
    height: clamp(20px, 5.5vw, 22px);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.55;
}

.icon-user {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237f8c8d'><path d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-5 0-9 2.5-9 6v2h18v-2c0-3.5-4-6-9-6Z'/></svg>");
}
.icon-lock {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237f8c8d'><path d='M12 1a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-1V6a5 5 0 0 0-5-5Zm-3 8V6a3 3 0 1 1 6 0v3H9Z'/></svg>");
}

/* 密码显示/隐藏 */
.icon-eye {
    left: auto;
    right: clamp(12px, 3.5vw, 16px);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237f8c8d'><path d='M12 5C5 5 1 12 1 12s4 7 11 7 11-7 11-7-4-7-11-7Zm0 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8Z'/></svg>");
    cursor: pointer;
}
.icon-eye.eye-open {
    opacity: 0.9;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231e88e5'><path d='M2 4l18 18-1.5 1.5L16 21l-2.5.5C6 21.5 1 14 1 14s1.5-2.5 4-4.8L4.5 8 3 9.5 2 4Zm10 1c7 0 11 7 11 7s-1.3 2.2-3.7 4.4L17 14a4 4 0 0 0-5-5L9.5 6.5A12 12 0 0 1 12 5Zm-4 9a4 4 0 0 0 4 4l-4-4Z'/></svg>");
}

/* ---------- 按钮 ---------- */
.btn-login {
    width: 100%;
    height: var(--input-h);
    border: none;
    border-radius: clamp(6px, 2vw, 10px);
    background: linear-gradient(135deg, var(--accent), var(--primary-dark));
    color: #fff;
    font-size: clamp(16px, 4.5vw, 17px);
    font-weight: 600;
    letter-spacing: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 6px 16px rgba(30, 136, 229, 0.35);
    margin-top: clamp(6px, 2vw, 10px);
}
.btn-login:active {
    transform: scale(0.98);
}
.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: clamp(16px, 4.5vw, 20px);
    height: clamp(16px, 4.5vw, 20px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: clamp(16px, 6vw, 24px);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.modal-dialog {
    background: #fff;
    border-radius: clamp(12px, 3.5vw, 16px);
    padding: clamp(20px, 6vw, 28px) clamp(20px, 6vw, 28px) clamp(18px, 5vw, 24px);
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-icon {
    width: clamp(48px, 13vw, 60px);
    height: clamp(48px, 13vw, 60px);
    margin: 0 auto clamp(12px, 3.5vw, 16px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: clamp(28px, 7vw, 36px);
    font-weight: 700;
}
.modal-icon.error {
    background: var(--danger);
}
.modal-icon.success {
    background: var(--success);
}
.modal-title {
    font-size: clamp(16px, 4.5vw, 18px);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: clamp(6px, 2vw, 8px);
}
.modal-body {
    font-size: clamp(13px, 3.8vw, 15px);
    color: var(--text-sub);
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.modal-code {
    margin-top: clamp(8px, 2.5vw, 12px);
    font-size: clamp(11px, 3.2vw, 13px);
    color: var(--danger);
    background: #fdecea;
    padding: clamp(4px, 1.2vw, 6px) clamp(8px, 2.5vw, 10px);
    border-radius: 6px;
    display: inline-block;
}
.modal-btn {
    margin-top: clamp(16px, 5vw, 22px);
    width: 100%;
    height: clamp(42px, 12vw, 46px);
    border: none;
    border-radius: clamp(6px, 2vw, 10px);
    background: var(--accent);
    color: #fff;
    font-size: clamp(15px, 4.2vw, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-btn:active {
    background: var(--primary-dark);
}

/* 弹窗过渡 */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.2s;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

/* ============================================================
 * 桌面端布局（≥768px）
 * ============================================================ */
@media (min-width: 768px) {
    .login-container {
        flex-direction: row;
    }

    /* 左侧品牌面板 */
    .brand-pane {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 55%;
        min-height: 100vh;
        background: linear-gradient(135deg, var(--bg-brand-start) 0%, var(--bg-brand-mid) 50%, var(--bg-brand-end) 100%);
        position: relative;
        overflow: hidden;
        padding: 48px clamp(32px, 5vw, 64px);
        color: #fff;
    }

    /* 装饰性背景圆圈 */
    .brand-pane::before {
        content: '';
        position: absolute;
        top: -200px;
        left: -200px;
        width: 500px;
        height: 500px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.05);
    }
    .brand-pane::after {
        content: '';
        position: absolute;
        bottom: -150px;
        right: -100px;
        width: 400px;
        height: 400px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.04);
    }

    .brand-inner {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;
        max-width: 480px;
        margin: 0 auto;
        width: 100%;
    }

    .brand-title {
        font-size: 36px;
        font-weight: 700;
        letter-spacing: 2px;
        margin-bottom: 8px;
        text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }

    .brand-subtitle {
        font-size: 14px;
        letter-spacing: 4px;
        opacity: 0.7;
        text-transform: uppercase;
        margin-bottom: 28px;
    }

    .brand-divider {
        width: 60px;
        height: 3px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 2px;
        margin-bottom: 28px;
    }

    .brand-desc {
        font-size: 16px;
        line-height: 1.8;
        opacity: 0.9;
        margin-bottom: 28px;
    }

    .brand-features {
        list-style: none;
        padding: 0;
    }

    .brand-features li {
        font-size: 15px;
        padding: 10px 0;
        display: flex;
        align-items: center;
        gap: 12px;
        opacity: 0.9;
    }

    .check-icon {
        display: inline-flex;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        align-items: center;
        justify-content: center;
        position: relative;
        flex-shrink: 0;
    }
    .check-icon::after {
        content: '';
        width: 10px;
        height: 5px;
        border-left: 2px solid #fff;
        border-bottom: 2px solid #fff;
        transform: rotate(-45deg) translate(1px, -1px);
    }

    .brand-footer {
        position: relative;
        z-index: 1;
        text-align: center;
        font-size: 12px;
        opacity: 0.5;
    }

    /* 右侧表单面板 */
    .form-pane {
        width: 45%;
        padding: 48px clamp(32px, 5vw, 80px);
        justify-content: center;
        align-items: center;
        background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    }

    .form-inner {
        max-width: 400px;
    }

    .form-header {
        text-align: left;
        margin-bottom: 32px;
    }

    .form-title {
        font-size: 28px;
        color: var(--text-main);
        margin-bottom: 6px;
        letter-spacing: 1px;
        text-shadow: none;
    }

    .form-subtitle {
        font-size: 14px;
        color: var(--text-sub);
        letter-spacing: 0;
    }

    /* 桌面端表单 */
    .login-form {
        background: #fff;
        border-radius: 12px;
        padding: 32px 28px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
        border: 1px solid #edf0f4;
    }

    .form-item {
        margin-bottom: 22px;
    }

    .form-item input {
        height: 52px;
        font-size: 15px;
    }

    .form-item label {
        font-size: 15px;
    }

    .btn-login {
        height: 52px;
        font-size: 17px;
        margin-top: 12px;
    }
}

/* 更大屏幕优化 */
@media (min-width: 1200px) {
    .brand-title {
        font-size: 42px;
    }
    .form-inner {
        max-width: 440px;
    }
    .form-title {
        font-size: 32px;
    }
}

/* 平板适配 */
@media (min-width: 768px) and (max-width: 1024px) {
    .brand-pane {
        padding: 40px 32px;
    }
    .brand-title {
        font-size: 28px;
    }
    .brand-desc {
        font-size: 14px;
    }
    .brand-features li {
        font-size: 13px;
    }
}
