/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: #333;
    padding: 16px;
    padding-bottom: 100px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    line-height: 1.6;
}

/* 主容器 */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 32px 24px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
}

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

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

.header h2 {
    color: #2d3748;
    font-size: 28px;
    font-weight: 700;
    display: inline-block;
    position: relative;
    padding-bottom: 12px;
}

.logo {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
}

.header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.header .subtitle {
    color: #718096;
    font-size: 14px;
    margin-top: 8px;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 24px;
}

.search-hint {
    text-align: center;
    font-size: 13px;
    color: #a0aec0;
    margin-top: 10px;
}

.search-form {
    display: flex;
    gap: 12px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    align-items: flex-end;
}

.search-form:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: #fff;
}

.input-group {
    display: flex;
    gap: 12px;
    flex: 1;
    width: 100%;
    min-width: 0;
}

.input-wrapper {
    flex: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-wrapper label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}

.search-form input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #2d3748;
    transition: all 0.2s ease;
}

.search-form input[type="text"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-form input[type="text"]::placeholder {
    color: #a0aec0;
}

.search-form input[type="text"]:invalid:not(:placeholder-shown) {
    border-color: #fc8181;
}

.search-form button[type="submit"] {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.search-form button[type="submit"]:active {
    transform: translateY(0);
}

.search-form button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 倒计时区域 */
.countdown-section {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: #fff;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(238, 90, 36, 0.3);
}

.countdown-section .countdown-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 8px;
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.countdown-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 8px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.countdown-item .number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    display: block;
}

.countdown-item .unit {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
    display: block;
}

/* 提示信息框 */
.info-box {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: none;
    padding: 20px;
    border-radius: 14px;
    margin-bottom: 24px;
}

/* 搜索结果区域 */
.results-section {
    margin-top: 24px;
}

/* 桌面端表格样式 */
.table-wrapper {
    display: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

th {
    padding: 16px 20px;
    color: #fff;
    font-weight: 600;
    text-align: left;
    font-size: 15px;
}

td {
    padding: 14px 20px;
    border-bottom: 1px solid #edf2f7;
    transition: background-color 0.2s ease;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background-color: #f7fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* 移动端卡片样式 */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-color: #667eea;
}

.file-card .file-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    word-break: break-all;
    font-size: 15px;
}

.file-card .file-actions {
    display: flex;
    gap: 10px;
}

/* 下载按钮 */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(72, 187, 120, 0.3);
    border: none;
    cursor: pointer;
    flex: 1;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

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

.download-btn svg {
    width: 18px;
    height: 18px;
}

/* 预览按钮 */
.preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(66, 153, 225, 0.3);
    border: none;
    cursor: pointer;
    flex: 1;
}

.preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

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

.preview-btn svg {
    width: 18px;
    height: 18px;
}

/* PDF 查看器 */
.pdf-viewer {
    margin-top: 24px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: #f8fafc;
    min-height: 200px;
}

.pdf-viewer:empty {
    display: none;
}

.pdf-viewer embed {
    display: block;
    width: 100%;
    height: 500px;
    border: none;
}

/* PDF 关闭按钮 */
.pdf-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: #f8fafc;
    border: none;
    color: #718096;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-close-btn:hover {
    background: #edf2f7;
    color: #2d3748;
}

.pdf-close-btn svg {
    width: 16px;
    height: 16px;
}

/* 空结果提示 */
.no-results {
    text-align: center;
    padding: 48px 24px;
    color: #718096;
    background: #f7fafc;
    border-radius: 14px;
    border: 2px dashed #e2e8f0;
}

.no-results .icon {
    display: block;
    margin-bottom: 16px;
    color: #a0aec0;
}

.no-results .icon svg {
    width: 48px;
    height: 48px;
}

.no-results .message {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #4a5568;
}

.no-results .hint {
    font-size: 14px;
    color: #a0aec0;
}

/* 结果统计 */
.results-count {
    font-size: 14px;
    color: #718096;
    margin-bottom: 16px;
    padding: 8px 16px;
    background: #f7fafc;
    border-radius: 8px;
    display: inline-block;
}

/* 页脚 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    color: #4a5568;
    text-align: center;
    padding: 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    font-size: 13px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.footer a:hover {
    color: #764ba2;
}

.footer .divider {
    color: #e2e8f0;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 响应式设计 - 平板 */
@media (min-width: 601px) {
    .table-wrapper {
        display: block;
    }
    
    .card-list {
        display: none;
    }
}

/* 响应式设计 - 移动端 */
@media (max-width: 600px) {
    body {
        padding: 10px;
        padding-bottom: 80px;
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }

    .container {
        padding: 20px 14px;
        border-radius: 16px;
    }

    .header {
        margin-bottom: 20px;
    }

    .header h2 {
        font-size: 22px;
    }

    .logo {
        height: 32px;
        margin-right: 8px;
    }

    .header .subtitle {
        font-size: 13px;
    }

    .search-section {
        margin-bottom: 16px;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch; /* 纵向排列时改为拉伸，避免输入区被压缩并靠右 */
        gap: 10px;
        padding: 12px;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .input-wrapper label {
        font-size: 12px;
    }

    .search-form input[type="text"] {
        padding: 12px 14px;
        font-size: 16px; /* 防止iOS缩放 */
    }

    .search-form button[type="submit"] {
        padding: 12px;
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 16px;
    }

    .search-hint {
        font-size: 12px;
        margin-top: 8px;
    }

    .countdown-section {
        padding: 14px;
        margin-bottom: 16px;
    }

    .countdown-section .countdown-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .countdown-grid {
        gap: 6px;
    }

    .countdown-item .number {
        font-size: 22px;
    }

    .countdown-item {
        padding: 8px 4px;
        border-radius: 8px;
    }

    .countdown-item .unit {
        font-size: 11px;
        margin-top: 2px;
    }

    .file-card {
        padding: 14px;
    }

    .file-card .file-name {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .file-card .file-actions {
        flex-direction: row;
        gap: 8px;
    }

    .download-btn,
    .preview-btn {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 44px;
    }

    .results-count {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .pdf-viewer {
        margin-top: 16px;
    }

    .pdf-viewer embed {
        height: 60vh;
        height: 60dvh;
    }

    .pdf-close-btn {
        padding: 10px;
        min-height: 44px;
    }

    .no-results {
        padding: 32px 16px;
    }

    .no-results .icon svg {
        width: 40px;
        height: 40px;
    }

    .no-results .message {
        font-size: 15px;
    }

    .no-results .hint {
        font-size: 13px;
    }

    /* 移动端页脚改为静态定位 */
    .footer {
        position: static;
        box-shadow: none;
        margin-top: 16px;
        padding: 12px;
        border-radius: 12px;
        backdrop-filter: none;
    }

    body {
        padding-bottom: 16px;
    }

    .footer-content {
        flex-direction: column;
        gap: 6px;
    }

    .footer a {
        font-size: 12px;
    }

    .footer .divider {
        display: none;
    }
}

/* 小屏幕手机 */
@media (max-width: 380px) {
    .container {
        padding: 16px 12px;
    }

    .header h2 {
        font-size: 20px;
    }

    .logo {
        height: 28px;
    }

    .countdown-item .number {
        font-size: 20px;
    }

    .countdown-item .unit {
        font-size: 10px;
    }

    .download-btn,
    .preview-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 选中文本颜色 */
::selection {
    background: #667eea;
    color: #fff;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .download-btn:hover,
    .preview-btn:hover,
    .search-form button[type="submit"]:hover {
        transform: none;
        box-shadow: none;
    }
    
    .download-btn:active,
    .preview-btn:active,
    .search-form button[type="submit"]:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .file-card:hover {
        box-shadow: none;
        border-color: #e2e8f0;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .pdf-viewer embed {
        height: 70vh;
    }

    .countdown-section {
        padding: 10px;
    }

    .countdown-item .number {
        font-size: 20px;
    }
}