﻿/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 100px; /* 直接设置上边距为100px */
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    /* 移除margin-top属性 */
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    top: 50px;
    border-radius: 12px;
    width: calc(100% - 40px); /* 新增宽度计算 */
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: modalopen 0.3s;
    box-sizing: border-box; /* 新增盒子模型 */
    max-height: 80vh; /* 限制最大高度 */
    overflow-y: auto; /* 允许滚动 */
    transform: translateY(0); /* 初始位置 */
    transform-origin: center center; /* 变换原点 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    .modal-content {
        width: calc(100% - 20px);
        margin: 5% auto;
        padding: 20px;
        max-height: 85vh;
    }
    
    .modal {
        top: 0; /* 移动端从顶部开始 */
        height: 100vh;
    }
}

@keyframes modalopen {
    from {opacity: 0; transform: translateY(-50px);}
    to {opacity: 1; transform: translateY(0);}
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

/* 表单样式 */
.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    border-color: #216d4a;
    outline: none;
}

.modal-content button[type="submit"] {
    background: linear-gradient(135deg, #216d4a, #2f8a64);
    color: white;
    border: none;
    padding: 12px 20px;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.modal-content button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 移动端输入框优化 */
@media (max-width: 768px) {
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 15px 12px; /* 增加触摸区域 */
        margin-bottom: 12px;
    }
    
    .modal-content textarea {
        min-height: 100px; /* 增加文本域高度 */
        resize: vertical; /* 允许垂直调整大小 */
    }
    
    /* 确保弹窗内容在小屏幕上可滚动 */
    .modal-content {
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    }
}

/* 防止iOS输入框聚焦时页面缩放 */
@supports (-webkit-touch-callout: none) {
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px !important;
    }
}