:root {
    --primary-color: #4361ee;
    --primary-light: #7209b7;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-color: #e2e8f0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    --accent-color: #4cc9f0;
    --success-color: #4ade80;
    --error-color: #f87171;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

/* 暗色模式 */
[data-theme="dark"] {
    --primary-color: #4cc9f0;
    --primary-light: #4361ee;
    --secondary-color: #a7a9be;
    --bg-color: #1a1c23;
    --card-bg: #252833;
    --text-color: #e5e7eb;
    --border-color: #334155;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --accent-color: #7209b7;
    --success-color: #4ade80;
    --error-color: #f87171;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-color);
    transition: background 0.3s ease;
    overflow: hidden;
}

/* 动态流动背景 */
body {
    position: relative;
    overflow: hidden;
}

body::before,
body::after,
body .bg-layer-1,
body .bg-layer-2 {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: all 0.5s ease;
    opacity: 0.6;
}

body::before {
    background: radial-gradient(circle at 20% 80%, rgba(67, 97, 238, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(114, 9, 183, 0.2) 0%, transparent 50%);
    animation: flow 20s ease-in-out infinite;
}

body::after {
    background: radial-gradient(circle at 60% 20%, rgba(76, 201, 240, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(251, 113, 133, 0.15) 0%, transparent 50%);
    animation: flow 15s ease-in-out infinite reverse;
}

body .bg-layer-1,
body .bg-layer-2 {
    position: fixed;
    width: 120%;
    height: 120%;
    top: -10%;
    left: -10%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: rotate(0deg);
    animation: shine 25s infinite linear;
}

body .bg-layer-2 {
    animation: shine 18s infinite linear reverse;
    background: linear-gradient(-45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
}

@keyframes flow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translate(20px, -20px) scale(1.05);
        opacity: 0.8;
    }
    50% {
        transform: translate(0, 0) scale(1);
        opacity: 0.7;
    }
    75% {
        transform: translate(-20px, 20px) scale(1.05);
        opacity: 0.9;
    }
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(0deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(360deg);
    }
}

/* 暗色模式动态背景 */
[data-theme="dark"] body::before {
    background: radial-gradient(circle at 20% 80%, rgba(76, 201, 240, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(67, 97, 238, 0.2) 0%, transparent 50%);
}

[data-theme="dark"] body::after {
    background: radial-gradient(circle at 60% 20%, rgba(114, 9, 183, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(251, 113, 133, 0.15) 0%, transparent 50%);
}

[data-theme="dark"] body .bg-layer-1,
[data-theme="dark"] body .bg-layer-2 {
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
}
.login-container {
    /* background: var(--card-bg); */
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.login-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: rotate(30deg);
    animation: shine 6s infinite linear;
    z-index: -1;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(30deg);
    }
    100% {
        transform: translateX(100%) rotate(30deg);
    }
}

[data-theme="dark"] .login-container::after {
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.02), transparent);
}
.login-header {
    background: var(--gradient-primary);
    padding: 32px 30px;
    text-align: center;
    color: #fff;
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.header-icon {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.header-icon:hover {
    transform: scale(1.05);
}

.header-icon i {
    font-size: 36px;
    color: #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.login-subtitle {
    font-size: 16px;
    opacity: 0.85;
    position: relative;
    z-index: 1;
}
.header-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.header-icon i {
    font-size: 32px;
    color: #fff;
}
.login-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.login-subtitle {
    font-size: 15px;
    opacity: 0.85;
}
.login-form {
    padding: 32px 30px;
}
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--text-color);
    font-weight: 500;
}

.input-group {
    position: relative;
    background: transparent;
    border-radius: 14px;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    overflow: hidden;
}

.form-control {
    width: 100%;
    height: 52px;
    padding: 0 45px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.05) 0%, rgba(76, 201, 240, 0.05) 100%);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

[data-theme="dark"] .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.1);
}

.input-group i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    font-size: 18px;
    transition: color 0.3s ease;
}

.input-group:focus-within i {
    color: var(--primary-color);
}

.form-control::placeholder {
    color: var(--secondary-color);
    opacity: 0.7;
}

.form-control:focus::placeholder {
    opacity: 0.5;
}
.submit-btn {
    width: 100%;
    height: 52px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.3);
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
    z-index: -1;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.submit-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
.submit-btn:hover {
    background: #34495e;
    transform: translateY(-1px);
}
.submit-btn:active {
    transform: translateY(0);
}
.error-message {
    background: rgba(248, 113, 113, 0.1);
    border: 2px solid var(--error-color);
    color: var(--error-color);
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.3s ease forwards;
}

.success-message {
    background: rgba(74, 222, 128, 0.1);
    border: 2px solid var(--success-color);
    color: var(--success-color);
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.password-toggle {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 2;
}
.password-toggle:hover {
    color: var(--primary-color);
}

/* 记住我勾选框样式 */
.remember-me {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 15px;
}

.remember-me label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 400;
    margin: 0;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.remember-me input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.remember-me input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.remember-me input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.remember-me a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.remember-me a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}
/* 隐藏浏览器默认的密码切换图标 */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}
/* 隐藏WebKit浏览器默认的密码切换图标 */
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    right: 0;
}
/* 确保密码输入框有足够的空间容纳两个图标 */
.input-group .password-input {
    padding-right: 60px;
}
/* 禁用浏览器自动填充样式 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    transition: background-color 5000s ease-in-out 0s;
}
/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(67, 97, 238, 0.4);
    z-index: 999;
    transition: all 0.3s ease;
    transform-origin: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.5);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    font-size: 22px;
    transition: transform 0.5s ease;
}

.theme-toggle:hover i {
    transform: rotate(180deg);
}
.theme-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(78,115,223,0.5);
}
.theme-toggle i {
    font-size: 20px;
}
@media (max-width: 480px) {
    body {
        padding: 20px;
    }
    .login-container {
        border-radius: 20px;
    }
    .login-header {
        padding: 28px 24px;
        border-radius: 20px 20px 0 0;
    }
    .login-form {
        padding: 28px 24px;
    }
    .header-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 14px;
    }
    .header-icon i {
        font-size: 28px;
    }
    .theme-toggle { bottom: 100px; right: 20px; width: 45px; height: 45px; }
}