/* 全局样式 */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --text-color: #1e293b;
    --text-light: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 网站头部 */
.site-header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.main-nav a {
    margin-left: 30px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
}

/* 主体内容 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* 英雄区域 */
.hero-section {
    text-align: center;
    padding: 60px 0;
}

.hero-section h1 {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.hero-section p {
    font-size: 18px;
    color: var(--text-light);
}

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

.search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-form button {
    padding: 15px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-form button:hover {
    background: var(--primary-hover);
}

/* 分类区域 */
.categories-section {
    margin-bottom: 60px;
}

.categories-section h2 {
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.category-card p {
    color: var(--text-light);
}

/* 试卷网格 */
.latest-section,
.related-exams {
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 28px;
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.exam-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.exam-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.exam-type {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.exam-type.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.exam-type.doc,
.exam-type.docx {
    background: #dbeafe;
    color: #2563eb;
}

.exam-card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-right: 50px;
}

.exam-card h3 a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s;
}

.exam-card h3 a:hover {
    color: var(--primary-color);
}

.exam-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.exam-meta span {
    padding: 4px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.exam-stats {
    display: flex;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-light);
}

/* 上传页面 */
.upload-section {
    max-width: 700px;
    margin: 0 auto;
}

.upload-section h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-align: center;
}

.section-desc {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
}

.upload-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.required {
    color: #ef4444;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* 文件上传区域 */
.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-color);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.file-drop-zone input[type="file"] {
    display: none;
}

.drop-zone-text svg {
    color: var(--text-light);
    margin-bottom: 15px;
}

.drop-zone-text p {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 8px;
}

.file-types {
    font-size: 13px;
    color: var(--text-light);
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-top: 10px;
}

.file-name {
    font-weight: 500;
}

.file-size {
    color: var(--text-light);
    font-size: 14px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.form-actions {
    margin-top: 30px;
}

.btn-loading {
    display: none;
}

/* 试卷详情页 */
.breadcrumb {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 14px;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-light);
}

.exam-detail {
    max-width: 900px;
    margin: 0 auto;
}

.exam-header {
    margin-bottom: 30px;
}

.exam-header h1 {
    font-size: 36px;
    margin-bottom: 15px;
}

.exam-header .exam-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.exam-header .exam-meta span {
    padding: 6px 14px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 14px;
}

.exam-description,
.exam-preview,
.exam-info {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.exam-description h2,
.exam-preview h2,
.exam-info h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* PDF预览 */
.pdf-preview {
    display: flex;
    justify-content: center;
    background: #f1f5f9;
    padding: 30px;
    border-radius: 8px;
}

#pdfCanvas {
    max-width: 100%;
    box-shadow: var(--shadow-lg);
}

.preview-note {
    text-align: center;
    color: var(--text-light);
    margin-top: 15px;
}

/* Word文档预览 */
.word-preview {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.word-preview-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.word-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.word-info {
    flex: 1;
}

.word-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.word-stats {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

.word-preview-content {
    padding: 20px;
    background: #fff;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.8;
    color: var(--text-color);
}

.word-preview-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.preview-ellipsis {
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
}

.word-preview-notice {
    padding: 40px;
    text-align: center;
    color: var(--text-light);
}

.word-preview-notice svg {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.word-preview-notice p {
    margin-bottom: 10px;
    font-size: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
}

.info-item .label {
    color: var(--text-light);
}

.info-item .value {
    font-weight: 500;
}

.exam-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
}

/* 分类页面 */
.category-header {
    text-align: center;
    margin-bottom: 40px;
}

.category-header h1 {
    font-size: 36px;
    margin-bottom: 15px;
}

.category-description {
    color: var(--text-light);
    font-size: 18px;
    margin-bottom: 10px;
}

.exam-count {
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.page-link {
    padding: 10px 16px;
    background: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.page-link:hover,
.page-link.active {
    background: var(--primary-color);
    color: white;
}

/* 网站页脚 */
.site-footer {
    background: var(--card-bg);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
}

/* 上传成功消息 */
.success-message {
    text-align: center;
    padding: 60px 20px;
}

.success-message svg {
    color: var(--success-color);
    margin-bottom: 20px;
}

.success-message h3 {
    font-size: 28px;
    margin-bottom: 10px;
}

.success-message p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.success-message .btn {
    margin: 0 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 32px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .main-nav a {
        margin: 0 15px;
    }
    
    .exam-actions {
        flex-direction: column;
    }
    
    .exam-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* 悬浮二维码 */
.floating-qr {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    text-align: center;
    transition: all 0.3s ease;
    pointer-events: none;
}

.floating-qr * {
    pointer-events: auto;
}

.floating-qr:hover {
    transform: translateY(-5px);
}

.qr-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    position: relative;
    margin-bottom: 10px;
    min-width: 150px;
}

.qr-container::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.qr-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    display: block;
    margin: 0 auto 10px;
    background: #f8f9fa;
    padding: 5px;
}

.qr-text {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}

.qr-subtitle {
    font-size: 10px;
    color: var(--text-light);
    margin: 5px 0 0 0;
}

.qr-toggle {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.qr-toggle:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.qr-content {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.qr-content.show {
    display: block;
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    .floating-qr {
        bottom: 20px;
        right: 20px;
    }
    
    .qr-container {
        min-width: 130px;
        padding: 12px;
    }
    
    .qr-image {
        width: 100px;
        height: 100px;
    }
    
    .qr-text {
        font-size: 11px;
    }
    
    .qr-subtitle {
        font-size: 9px;
    }
    
    .qr-toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .floating-qr {
        bottom: 15px;
        right: 15px;
    }
    
    .qr-container {
        min-width: 120px;
        padding: 10px;
    }
    
    .qr-image {
        width: 90px;
        height: 90px;
    }
}
