/* ============================================
   基础设置
   ============================================ */

/* 根字体大小 - 根据视口宽度动态调整 */
html {
    font-size: clamp(12px, 2.5vw, 16px);
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', '微软雅黑', 'SimSun', '宋体', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 1.25rem;
    position: relative;
}

/* ============================================
   查询页面
   ============================================ */

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 4rem);
    padding-bottom: 3rem;
}

.query-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15), 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 25rem;
    animation: fadeInUp 0.6s ease-out;
    transition: transform 0.3s, box-shadow 0.3s;
}

.query-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 1.25rem 4rem rgba(0, 0, 0, 0.2), 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.query-box h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 0.625rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 1.875rem;
    font-size: 1rem;
    font-weight: 500;
}

.hint {
    text-align: center;
    color: #999;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    font-style: italic;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 0.5rem;
}

/* 表单元素 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s;
    background: #fff;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.error-message {
    color: #e74c3c;
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    padding: 0.875rem;
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    border-left: 4px solid #e74c3c;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.25rem 1rem rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-btn:hover::before {
    width: 300px;
    height: 300px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(102, 126, 234, 0.5);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ============================================
   成员选择框
   ============================================ */

.selection-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.875rem;
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 31.25rem;
    margin-top: 1.25rem;
    box-sizing: border-box;
    animation: fadeInUp 0.4s ease-out;
}

.selection-box h3 {
    color: #333;
    text-align: center;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.member-list {
    max-height: 25rem;
    overflow-y: auto;
    margin-bottom: 1.25rem;
    padding-right: 0.5rem;
}

.member-list::-webkit-scrollbar {
    width: 6px;
}

.member-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.member-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.member-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.member-item {
    padding: 1.125rem;
    border: 2px solid #e0e0e0;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
}

.member-item:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f0ff 0%, #ffffff 100%);
    box-shadow: 0 0.25rem 1rem rgba(102, 126, 234, 0.2);
    transform: translateX(4px);
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.member-id {
    font-weight: 600;
    color: #667eea;
    font-size: 1rem;
}

.member-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
}

.member-hours {
    color: #666;
    font-size: 0.875rem;
}

.cancel-btn {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    color: #333;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #d0d0d0 0%, #c0c0c0 100%);
    transform: translateY(-1px);
}

/* ============================================
   感谢信页面
   ============================================ */

.certificate-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 4rem);
    padding-bottom: 3rem;
}

.certificate {
    position: relative;
    width: 794px; /* A4宽度 - 保留px用于打印标准 */
    height: 1123px; /* A4高度 - 保留px用于打印标准 */
    background: white;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.2), 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    margin-bottom: 1.875rem;
    overflow: hidden;
    border-radius: 0.5rem;
    animation: fadeIn 0.6s ease-out;
    /* 设置基础字体大小为证书宽度，这样百分比就是相对于宽度的 */
    font-size: 794px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.certificate-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 1;
    visibility: visible;
}

.certificate-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 1;
    visibility: visible;
}

.certificate-content {
    position: relative;
    z-index: 2;
    /* 使用百分比保持固定比例：80px/794px ≈ 10.08%, 100px/794px ≈ 12.59% */
    padding: 10.08% 12.59%;
    height: 100%;
    margin-top: 6%; /* 20px/1123px */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.name-section {
    text-align: center;
    margin-bottom: 2%; /* 60px/1123px */
}

.name-section h2 {
    /* 字体大小相对于证书宽度：48px/794px ≈ 6.05% */
    font-size: 4.5%;
    color: #1a1a1a; /* 使用更深的颜色，确保对比度 */
    font-weight: bold;
    margin: 0;
    letter-spacing: 0.252%; /* 2px/794px */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* 添加文字阴影，增强可读性 */
}

.content-section {
    line-height: 2.2;
    /* 字体大小相对于证书宽度：20px/794px ≈ 2.52% */
    font-size: 2.4%;
    color: #1a1a1a; /* 使用更深的颜色，确保对比度 */
    text-align: justify;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* 添加文字阴影，增强可读性 */
}

.paragraph {
    margin-bottom: 2%; /* 30px/1123px */
    text-indent: 2em;
}

/* ============================================
   功能选择页面
   ============================================ */

.function-selection {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.875rem;
}

.function-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 2px solid #e0e0e0;
    border-radius: 1rem;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.function-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.function-btn:hover::before {
    width: 300px;
    height: 300px;
}

.function-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.function-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.function-btn:hover .function-icon {
    transform: scale(1.1);
}

.function-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.function-btn:hover .function-title {
    color: #667eea;
}

.function-desc {
    font-size: 0.9375rem;
    color: #666;
    text-align: center;
}

.certificate-btn:hover {
    background: linear-gradient(135deg, #f0f0ff 0%, #ffffff 100%);
}

.invitation-btn:hover {
    background: linear-gradient(135deg, #fff5f0 0%, #ffffff 100%);
}

.thanks-btn:hover {
    background: linear-gradient(135deg, #f0fff4 0%, #ffffff 100%);
}

/* ============================================
   邀请函页面
   ============================================ */

.invitation {
    /* 复用证书样式，可以单独定制 */
}

.invitation-content {
    /* 复用证书内容样式 */
    padding-top: 50%; /* 增加上边距，留出更多空白 */
    padding-bottom: 10.08%; /* 保持底部边距不变 */
    justify-content: flex-start; /* 内容从顶部开始，而不是居中 */
    margin-top: 0; /* 移除margin-top，使用padding-top控制位置 */
}

.invitation-greeting {
    text-align: left;
    margin-bottom: 1.5%;
}

.invitation-greeting p {
    font-size: 2.8%;
    color: #1a1a1a;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.invitation-body {
    line-height: 1.5; /* 进一步缩减行高 */
    font-size: 2.4%;
    color: #1a1a1a;
    text-align: justify;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.invitation-paragraph {
    margin-bottom: 1.4%; /* 进一步减小段落间距 */
    text-indent: 2em;
}

.invitation-info {
    margin: 1.5% 0; /* 进一步减小信息区域上下边距 */
    padding: 1.2% 0; /* 进一步减小信息区域内边距 */
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.info-title {
    font-weight: 600;
    margin-bottom: 1%; /* 进一步减小标题下边距 */
    margin-top: 1.2%; /* 进一步减小标题上边距 */
    text-indent: 0;
}

.info-title:first-child {
    margin-top: 0;
}

.info-line {
    margin-bottom: 0.7%; /* 进一步减小信息行间距 */
    text-indent: 0;
    line-height: 1.5; /* 统一行高 */
}

.info-line strong {
    font-weight: 600;
}

/* 下载区域 */
.download-section {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.download-btn {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.25rem 1rem rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.download-btn:hover::before {
    width: 300px;
    height: 300px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(102, 126, 234, 0.5);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.back-link {
    padding: 1rem 1.875rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 0.75rem;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
}

.back-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(102, 126, 234, 0.3);
}

/* ============================================
   致谢函页面
   ============================================ */

.thanks {
    /* 复用证书样式，可以单独定制 */
}

.thanks-content {
    /* 复用证书内容样式 */
    padding-top: 28%; /* 增加上边距，留出更多空白 */
    padding-bottom: 10.08%; /* 保持底部边距不变 */
    justify-content: flex-start; /* 内容从顶部开始，而不是居中 */
    margin-top: 0; /* 移除margin-top，使用padding-top控制位置 */
}

.thanks-greeting {
    text-align: left;
    margin-bottom: 1.5%;
}

.thanks-greeting p {
    font-size: 2.2%;
    color: #1a1a1a;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.thanks-body {
    line-height: 1.5; /* 进一步缩减行高 */
    font-size: 2.2%;
    color: #1a1a1a;
    text-align: justify;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.thanks-paragraph {
    margin-bottom: 1.4%; /* 进一步减小段落间距 */
    text-indent: 2em;
}

/* ============================================
   版权信息
   ============================================ */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.25rem;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer p {
    color: #666;
    font-size: 0.875rem;
    margin: 0;
    font-weight: 500;
}

/* ============================================
   响应式设计
   ============================================ */

/* 平板端 (≤900px) */
@media (max-width: 900px) {
    html {
        font-size: clamp(12px, 2.2vw, 15px);
    }
    
    .certificate-container {
        padding: 0.625rem;
        padding-bottom: 4rem;
    }
    
    .certificate {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 210 / 297;
        margin-bottom: 1.25rem;
    }
}

/* 手机端 (≤600px) */
@media (max-width: 600px) {
    html {
        font-size: clamp(12px, 3vw, 14px);
    }
    
    body {
        padding: 0.625rem;
        padding-bottom: 4rem;
    }
    
    .container {
        align-items: flex-start;
        padding-top: 1.25rem;
        padding-bottom: 4rem;
    }
    
    .query-box {
        padding: 1.5625rem 1.25rem;
        max-width: 100%;
        border-radius: 1rem;
    }
    
    .query-box h1 {
        font-size: 1.571rem;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .hint {
        font-size: 0.857rem;
        margin-bottom: 0.9375rem;
    }
    
    .form-group {
        margin-bottom: 0.9375rem;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.375rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.75rem;
        font-size: 1rem; /* 保持1rem避免iOS自动缩放 */
        border-radius: 0.625rem;
    }
    
    .form-group select {
        padding-right: 2.5rem;
    }
    
    .error-message {
        padding: 0.75rem;
        font-size: 0.929rem;
        margin-bottom: 0.9375rem;
    }
    
    .submit-btn {
        padding: 0.875rem;
        font-size: 1rem;
        border-radius: 0.625rem;
    }
    
    .certificate-container {
        padding: 0.3125rem;
        padding-bottom: 4rem;
    }
    
    .certificate {
        margin-bottom: 0.9375rem;
        box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.15);
        border-radius: 0.375rem;
    }
    
    .download-section {
        flex-direction: column;
        width: 100%;
        gap: 0.625rem;
    }
    
    .download-btn,
    .back-link {
        width: 100%;
        text-align: center;
        padding: 0.875rem;
        font-size: 0.9375rem;
        border-radius: 0.625rem;
    }
    
    .selection-box {
        padding: 1.25rem 0.9375rem;
        max-width: 100%;
        margin-top: 0.9375rem;
        border-radius: 1rem;
    }
    
    .selection-box h3 {
        font-size: 1rem;
        margin-bottom: 0.9375rem;
    }
    
    .member-list {
        max-height: 18.75rem;
    }
    
    .member-item {
        padding: 0.875rem;
        border-radius: 0.625rem;
    }
    
    .member-id {
        font-size: 0.929rem;
    }
    
    .member-name {
        font-size: 0.9375rem;
    }
    
    .member-hours {
        font-size: 0.857rem;
    }
    
    .cancel-btn {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.625rem;
    }
    
    .function-selection {
        gap: 0.9375rem;
        margin-top: 1.25rem;
    }
    
    .function-btn {
        padding: 1.5625rem 1.25rem;
        border-radius: 0.875rem;
    }
    
    .function-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
    
    .function-title {
        font-size: 1.25rem;
    }
    
    .function-desc {
        font-size: 0.875rem;
    }
    
    .footer {
        padding: 0.625rem 1rem;
    }
    
    .footer p {
        font-size: 0.75rem;
    }
}

/* 超小屏幕 (≤480px) */
@media (max-width: 480px) {
    html {
        font-size: clamp(11px, 3.5vw, 13px);
    }
    
    body {
        padding: 0.3125rem;
        padding-bottom: 4rem;
    }
    
    .query-box {
        padding: 1.25rem 0.9375rem;
        border-radius: 0.875rem;
    }
    
    .query-box h1 {
        font-size: 1.538rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .hint {
        font-size: 0.846rem;
    }
    
    .form-group input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .submit-btn {
        padding: 0.875rem;
        font-size: 0.9375rem;
    }
    
    .download-btn,
    .back-link {
        padding: 0.875rem;
        font-size: 1rem;
    }
    
    .selection-box {
        padding: 0.9375rem 0.75rem;
        border-radius: 0.875rem;
    }
    
    .selection-box h3 {
        font-size: 0.9375rem;
    }
    
    .member-item {
        padding: 0.75rem;
    }
    
    .member-id {
        font-size: 0.923rem;
    }
    
    .member-name {
        font-size: 1rem;
    }
    
    .member-hours {
        font-size: 0.846rem;
    }
    
    .footer p {
        font-size: 0.7rem;
    }
}
