/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: #333;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background: linear-gradient(-45deg, #f0f5ff, #f5f0ff, #fff0f5, #fffaf0);
    background-size: 400% 400%;
    animation: gradientBackground 20s ease infinite;
}

@keyframes gradientBackground {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #1a5276;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}

/* 表单样式 */
form {
    background: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    width: 100%;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease;
}

form:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transform: translateY(-5px);
}

form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #3498db, #9b59b6, #e74c3c, #f1c40f);
    background-size: 300% 300%;
    animation: gradientBorder 10s ease infinite;
    z-index: 1;
}

@keyframes gradientBorder {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.form-row {
    display: flex;
    margin-bottom: 25px;
    gap: 20px;
    width: 100%;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    min-width: 0; /* 防止flex子项溢出 */
}

/* 添加图标容器 */
.input-with-icon {
    position: relative;
    width: 100%;
}

.icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    width: 20px;
    height: 20px;
    z-index: 2;
}

.with-icon {
    padding-left: 35px !important;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    font-size: clamp(0.875rem, 2vw, 1rem);
}

label i {
    color: #3498db;
    font-size: 16px;
    flex-shrink: 0;
}

input, select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: rgba(249, 249, 249, 0.8);
    width: 100%;
    max-width: 100%;
    height: 48px;
}

input:hover, select:hover {
    background-color: #fff;
    border-color: #bdc3c7;
}

input:focus, select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
    background-color: #fff;
}

.required {
    color: #e74c3c;
    margin-left: 4px;
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 6px;
    min-height: 20px;
    font-weight: 500;
    width: 100%;
}

/* 验证码样式 */
.captcha-row {
    /* 确保验证码行的布局不受其他设置影响 */
    flex-direction: column !important;
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    flex-wrap: nowrap;
    margin-top: 0;
}

.captcha-container .input-with-icon {
    flex: 0 1 40%;
    min-width: 120px;
}

.captcha-image {
    background: linear-gradient(145deg, #f0f0f0, #e6e6e6);
    padding: 10px;
    border-radius: 8px;
    min-width: 120px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 5px;
    user-select: none;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05);
    color: #2c3e50;
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.captcha-image:hover {
    background: linear-gradient(145deg, #e8e8e8, #f2f2f2);
    box-shadow: inset 2px 2px 8px rgba(0,0,0,0.08);
}

.captcha-image:active {
    transform: scale(0.98);
}

/* 按钮样式 */
button[type="submit"] {
    background: linear-gradient(to right, #3498db, #9b59b6);
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    height: 54px;
}

button[type="submit"]:hover {
    background: linear-gradient(to right, #2980b9, #8e44ad);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.4);
}

/* 提交成功消息 */
.submission-message {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease forwards;
    margin-top: 20px;
}

.submission-message h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none;
}

footer {
    margin-top: 40px;
    text-align: center;
    color: #555;
    font-size: 14px;
    padding: 20px 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.footer-links a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #2980b9;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-animate-success {
    animation: successPulse 0.5s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.valid-input {
    border-color: #2ecc71 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232ecc71' width='18px' height='18px'%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px !important;
}

.custom-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 300px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease forwards;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-content i {
    font-size: 24px;
    color: #e74c3c;
}

.alert-content p {
    margin: 0;
    font-size: 16px;
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #7f8c8d;
}

.alert-close:hover {
    color: #34495e;
}

.header-img img{
    max-width: 280px;
    margin-bottom: 15px;
}

.header-img p {
    color: #555;
    font-size: 18px;
    margin-bottom: 20px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.modal-close:hover {
    color: #34495e;
}

.modal-body {
    line-height: 1.6;
    color: #555;
}

.modal-body h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 5px;
}

.show-modal {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .captcha-container {
        flex-direction: row;
        gap: 10px;
    }
    
    .captcha-container .input-with-icon {
        flex: 1;
        min-width: 0;
    }
    
    .captcha-image {
        min-width: 100px;
        font-size: 18px;
    }
    
    input, select, button {
        font-size: 16px;
        height: 45px;
    }
    
    .container {
        padding: 15px;
    }
    
    form {
        padding: 20px;
    }
    
    label {
        font-size: 14px;
    }
    
    .header-img img{
        max-width: 220px;
    }
    
    .header-img p {
        font-size: 16px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
}

@media (max-width: 360px) {
    input, select {
        font-size: 14px;
        height: 42px;
        padding: 8px 12px;
    }
    
    .with-icon {
        padding-left: 30px !important;
    }
    
    .form-row {
        margin-bottom: 15px;
    }
    
    .captcha-container {
        flex-direction: row;
    }
    
    .captcha-container .input-with-icon {
        flex: 1;
        min-width: 0;
    }
    
    .captcha-image {
        min-width: 90px;
        font-size: 16px;
        letter-spacing: 3px;
        height: 42px;
    }
    
    form {
        padding: 15px;
    }
    
    .container {
        padding: 10px;
    }
    
    .header-img img{
        max-width: 180px;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
}