/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* 为底部菜单留出空间 */
    background: white; /* 设置白色背景 */
}


/* PDF查看器容器 */
.pdf-viewer-container {
    flex: 1;
    padding: 0; /* 去掉所有内边距，实现全屏显示 */
    position: relative;
}

.pdf-viewer {
    background: transparent;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.welcome-message h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.welcome-message p {
    font-size: 1rem;
    color: #888;
}

/* PDF控制按钮 */
.pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 10px 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100;
}

.control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.control-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#page-info {
    font-weight: 600;
    color: #333;
    min-width: 80px;
    text-align: center;
}

/* 底部悬浮菜单 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    border-top: 1px solid #eee;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    min-width: 50px;
    flex: 1;
    position: relative;
}

.nav-item:hover {
    background-color: #f8f9ff;
    transform: translateY(-2px);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.nav-item span {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 小加载动画 */
.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.loading p {
    color: #666;
    font-size: 1rem;
}

/* 错误提示 */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 2000;
    max-width: 300px;
    width: 90%;
}

.error-message p {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 1rem;
}

.close-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #c0392b;
}

/* PDF Canvas 样式 */
#pdf-canvas {
    max-width: 100%;
    height: auto;
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .pdf-viewer-container {
        padding: 0; /* 移动端也保持全屏 */
    }
    
    .pdf-controls {
        margin: 10px;
        padding: 10px 15px;
    }
    
    .nav-item {
        padding: 6px 4px;
        min-width: 45px;
    }
    
    .nav-item span {
        font-size: 0.75rem;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .control-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 70px;
    }
}

@media (max-width: 360px) {
    .nav-item {
        padding: 6px 2px;
        min-width: 40px;
    }
    
    .nav-item span {
        font-size: 0.65rem;
    }
    
    .nav-icon {
        font-size: 1.1rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .nav-item:hover {
        background-color: transparent;
        transform: none;
    }
    
    .nav-item:active {
        background-color: #f8f9ff;
        transform: scale(0.95);
    }
    
    .control-btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .control-btn:active {
        transform: scale(0.95);
    }
}

/* 页面切换动画 */
.pdf-viewer {
    transition: all 0.3s ease;
}

.pdf-viewer.loading {
    opacity: 0.7;
    transform: scale(0.98);
}

/* 菜单项加载状态 */
.nav-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.nav-item.loading .nav-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 成功提示 */
.success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #27ae60;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 1500;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 页面指示器 */
.page-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    z-index: 100;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

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

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-header .close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 20px;
}

.upload-section, .config-section {
    margin-bottom: 30px;
}

.upload-section h3, .config-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.file-input:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.upload-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.page-configs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-config {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.page-config label {
    min-width: 80px;
    font-weight: 500;
    color: #333;
}

.page-config input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

.page-config input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.page-config span {
    color: #666;
    font-weight: 500;
}

.action-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.generate-btn, .reset-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.reset-btn {
    background: #6c757d;
    color: white;
}

.reset-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* 移动端模态框优化 */
@media (max-width: 480px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .page-config {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .page-config label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .page-config input {
        width: 100%;
        max-width: 120px;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .generate-btn, .reset-btn {
        width: 100%;
    }
}
