/* 全局样式重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* 页面背景与居中布局 */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh; 
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

/* 登录卡片容器 */
.login-container {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    transition: padding 0.3s ease;
}

/* 标题样式 */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
    /* 核心：设置为相对定位，作为气泡绝对定位的参考点 */
    position: relative; 
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; 
    transition: border-color 0.3s ease;
    -webkit-tap-highlight-color: transparent; 
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 核心：自定义气泡提示样式 */
.custom-bubble {
    position: absolute;
    /* 定位在输入框正上方 */
    bottom: 100%; 
    left: 0;
    margin-bottom: 8px; /* 气泡与输入框的间距 */
    background-color: #ff4d4f; /* 警示红背景 */
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    width: 100%;
    z-index: 10;
    
    /* 默认隐藏状态 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px); /* 稍微向下偏移，方便做上浮动画 */
    transition: all 0.3s ease;
    
    /* 增加一个小三角箭头指向下方 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.custom-bubble::after {
    content: '';
    position: absolute;
    top: 100%; /* 放在气泡底部 */
    left: 20px; /* 箭头位置 */
    border-width: 6px;
    border-style: solid;
    border-color: #ff4d4f transparent transparent transparent;
}

/* 核心逻辑：当输入框被聚焦(focus) 且 内容无效(invalid)时，显示气泡 */
.form-group input:focus:invalid {
    border-color: #ff4d4f; /* 输入框边框变红 */
}

.form-group input:focus:invalid + .custom-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0); /* 上浮到正常位置 */
}

/* 登录按钮样式 */
.login-btn {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.login-btn:active {
    background: #5a6fd6;
    transform: scale(0.98);
}

/* 底部链接样式 */
.footer-links {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    padding: 5px 0; 
}

/* 错误提示文字 */
.error-msg {
    color: #ff4d4f;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

/* 移动端专属适配 */
@media (max-width: 480px) {
    .login-container {
        width: 88%;
        padding: 30px 20px;
    }
    .login-header h2 {
        font-size: 24px;
    }
    .login-header p {
        font-size: 13px;
    }
    .footer-links {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
}
