@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden; /* 防止动画元素溢出 */
}

.login-container {
    position: relative; /* 用于定位伪元素 */
    background-color: rgba(255, 255, 255, 0.95); /* 略微透明 */
    padding: 40px 50px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 380px;
    z-index: 1;
    overflow: hidden; /* 配合伪元素动画 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* 添加一些背景装饰动画 */
body::before,
body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.3));
    border-radius: 50%;
    z-index: 0;
    animation: float 15s infinite ease-in-out alternate;
}

body::before {
    top: -10%;
    left: -15%;
    animation-delay: 2s;
}

body::after {
    bottom: -15%;
    right: -10%;
    animation-delay: 5s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(20px, 30px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}


h2 {
    margin-bottom: 25px;
    color: #333;
    font-weight: 600;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative; /* 用于label动画 */
}

label {
    position: absolute;
    top: 14px;
    left: 15px;
    color: #aaa;
    font-size: 16px;
    pointer-events: none;
    opacity: 1; /* Start visible */
    visibility: visible; /* Start visible */
    transition: opacity 0.3s ease, visibility 0.3s ease; /* Transition opacity and visibility */
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 15px 15px 15px 15px; /* 调整内边距 */
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background-color: #f9f9f9;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

/* Style input when focused or when placeholder is not shown (has content) */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="text"]:not(:placeholder-shown),
input[type="password"]:not(:placeholder-shown) {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.2);
}

/* Hide label when input is focused or when placeholder is not shown */
input[type="text"]:focus + label,
input[type="password"]:focus + label,
input[type="text"]:not(:placeholder-shown) + label,
input[type="password"]:not(:placeholder-shown) + label {
    opacity: 0; /* Fade out */
    visibility: hidden; /* Hide completely and remove from layout */
    pointer-events: none;
    /* No need to reset top/left/font-size as visibility handles layout */
}


button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 10px; /* 增加按钮与上方元素的间距 */
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.message {
    margin-top: 20px;
    font-weight: bold;
    min-height: 20px; /* 占位，防止布局跳动 */
}

.message.success {
    color: #28a745; /* 绿色表示成功 */
}

.message.error {
    color: #dc3545; /* 红色表示错误 */
}