﻿/* 基础样式重置与变量定义 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #f9fafb;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-radius: 12px;
    --transition: all 0.3s ease;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --error-color: #ef4444;
    --success-color: #10b981;
}

/* 主容器样式 */
.login-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px 15px 100px;
    color: var(--text-color);
}

/* 头部样式 */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

    .login-header h1 {
        font-size: 1.8rem;
        color: var(--primary-color);
        margin-bottom: 10px;
    }

    .login-header p {
        font-size: 1rem;
        color: var(--text-secondary);
    }

/* 登录卡片样式 */
.login-card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 30px;
    margin-bottom: 30px;
    transition: var(--transition);
}

    .login-card:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-control {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #f9fafb;
}

    .form-control:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

/* 输入框图标 */
.input-icon::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.input-icon.user::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236b7280' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

.input-icon.password::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236b7280' viewBox='0 0 24 24'%3E%3Cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/%3E%3C/svg%3E");
}

/* 错误提示样式 */
.error-message {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

.form-control.error {
    border-color: var(--error-color);
}

    .form-control.error + .error-message {
        display: block;
    }

/* 表单选项样式 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
}

    .remember-me input {
        margin-right: 8px;
    }

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

    .forgot-password:hover {
        color: var(--primary-hover);
        text-decoration: underline;
    }

/* 按钮样式 */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 15px;
    text-align: center;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-hover);
    }

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

    .btn-secondary:hover {
        background: #f0f5ff;
    }

/* 注册链接样式 */
.register-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

    .register-link a {
        color: var(--primary-color);
        text-decoration: none;
        font-weight: 500;
        transition: var(--transition);
    }

        .register-link a:hover {
            color: var(--primary-hover);
            text-decoration: underline;
        }

/* 帮助区域样式 */
.help-section {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

    .help-section a {
        color: var(--primary-color);
        text-decoration: none;
        transition: var(--transition);
    }

        .help-section a:hover {
            color: var(--primary-hover);
            text-decoration: underline;
        }

/* 响应式调整 */
@media (min-width: 768px) {
    .login-container {
        padding: 40px 20px 120px;
    }

    .login-header h1 {
        font-size: 2.1rem;
    }

    .login-header p {
        font-size: 1.1rem;
    }

    .login-card {
        padding: 40px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    animation: fadeIn 0.4s ease forwards;
}

/* 按钮悬停效果 */
.btn {
    position: relative;
    overflow: hidden;
}

    .btn::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 5px;
        height: 5px;
        background: rgba(255, 255, 255, 0.5);
        opacity: 0;
        border-radius: 100%;
        transform: scale(1, 1) translate(-50%);
        transform-origin: 50% 50%;
    }

    .btn:hover::after {
        animation: ripple 0.6s ease-out;
    }

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* 无障碍优化 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 输入框焦点样式 */
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 记住我复选框样式 */
.remember-me input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    margin-right: 8px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

    .remember-me input[type="checkbox"]:checked {
        background-color: 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: 0.8rem;
            font-weight: bold;
        }

/* 成功状态样式 */
.form-control.success {
    border-color: var(--success-color);
}
