/* 全局样式重置与基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f7fa;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 顶部导航栏样式 */
#above {
    height: auto;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 15px 0;
    position: relative;
    z-index: 100;
}

#img {
    float: left;
    margin-left: 20px;
}

#img img {
    max-height: 60px;
    transition: transform 0.3s ease;
}

#img img:hover {
    transform: scale(1.05);
}

#a_ {
    float: right;
    font-size: 14px;
    padding: 20px 30px 0 0;
}

.a {
    margin-left: 20px;
}

.a a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.a a:hover {
    color: #1677ff;
}

.clear {
    clear: both;
}

/* 主内容区域 - 使用广告图片作为背景 */
#middle {
    min-height: calc(100vh - 150px);
    background: url(../img/advertisement.png) no-repeat center center fixed;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px 0;
    /* 确保背景图片始终可见 */
    background-attachment: scroll;
}

/* 背景遮罩，增强表单可读性但不影响背景图片显示 */
#middle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* 登录表单容器 - 卡片式设计 */
#loginForm {
    width: 400px;
    height: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 10;
    padding: 40px;
    animation: formAppear 0.8s ease-out;
}

@keyframes formAppear {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 登录标题 */
#register {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

#register::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #1677ff, #02a7f0);
    border-radius: 3px;
}

/* 输入框容器样式 */
#username_div,
#password_div {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

/* 输入框图标 */
#row1,
#row2 {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    z-index: 2;
}

#row1 {
    background-image: url(../img/account.png);
    background-size: contain;
    background-repeat: no-repeat;
}

#row2 {
    background-image: url(../img/psw.png);
    background-size: contain;
    background-repeat: no-repeat;
}

/* 输入框样式 */
input[type="text"],
input[type="password"] {
    width: 100%;
    height: 45px;
    padding: 0 15px 0 45px;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
    transform: translateY(-1px);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: #c9cdd4;
}

/* 提示信息样式 */
.tips {
    margin: 5px 0 0 0;
    font-size: 12px;
    line-height: 20px;
    height: 20px;
    min-height: 20px;
}

.error {
    color: #f5222d;
    display: inline-block;
}

/* 登录按钮样式 */
input[type="submit"] {
    width: 100%;
    height: 45px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    background: linear-gradient(90deg, #1677ff, #02a7f0);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    letter-spacing: 1px;
}

input[type="submit"]:hover {
    background: linear-gradient(90deg, #0958d9, #0091ff);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 119, 255, 0.4);
}

input[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

/* 注册链接区域 */
.margin {
    text-align: center;
    margin-top: 20px;
}

.register-link {
    color: #1677ff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.register-link:hover {
    color: #0958d9;
    text-decoration: underline;
}

/* 分隔线样式 */
hr {
    margin: 25px 0;
    border: none;
    height: 1px;
    background: #f0f0f0;
    position: relative;
}

hr::before {
    content: '其他登录方式';
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 20px;
    color: #999;
    font-size: 12px;
}

/* 社交媒体登录选项 (预留) */
.social-login {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 10px;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e5e6eb;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-btn:hover {
    border-color: #1677ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    #above {
        padding: 10px 0;
    }
    
    #img {
        margin-left: 10px;
    }
    
    #img img {
        max-height: 40px;
    }
    
    #a_ {
        padding: 12px 15px 0 0;
        font-size: 12px;
    }
    
    .a {
        margin-left: 10px;
    }
    
    #middle {
        padding: 20px 0;
    }
    
    #loginForm {
        width: 90%;
        max-width: 360px;
        padding: 30px 20px;
        margin: 0 auto;
    }
    
    #register {
        font-size: 20px;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="submit"] {
        height: 42px;
    }
    
    .social-login {
        gap: 20px;
    }
}

/* 加载动画效果 */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* 表单验证成功动画 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.form-error {
    animation: shake 0.6s ease-in-out;
}

/* 渐变动画背景（用于增强视觉效果） */
.gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(22, 119, 255, 0.1) 0%, rgba(0, 0, 0, 0) 90%);
    pointer-events: none;
    z-index: 1;
}

/* 美化滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
