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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
}

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

/* ==================== 头部 ==================== */
.header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2em;
    color: #667eea;
    margin: 0;
}

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

/* ==================== 统计信息 ==================== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

/* ==================== 搜索栏 ==================== */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

/* ==================== 标签页 ==================== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: white;
    color: #666;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

/* ==================== PDF列表 ==================== */
.pdf-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pdf-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
}

.pdf-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.pdf-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.pdf-info {
    flex: 1;
    min-width: 0;
}

.pdf-name {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-path {
    font-size: 0.85em;
    color: #999;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: #666;
}

.pdf-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* ==================== 徽章 ==================== */
.badge {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.85em;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 1.2em;
}

/* ==================== 加载状态 ==================== */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.empty-state p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 0.9em !important;
    color: #999 !important;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

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

.modal-header h2 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.cache-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.cache-info p {
    margin: 10px 0;
}

/* ==================== 进度条 ==================== */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

/* ==================== 阅读器样式 ==================== */
.reader-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #2c3e50;
}

.reader-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toolbar-left {
    flex: 1;
}

.toolbar-center {
    flex: 0;
}

.toolbar-right {
    flex: 1;
    justify-content: flex-end;
}

.pdf-title {
    color: white;
    font-size: 1.1em;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.page-info {
    color: white;
    font-size: 1em;
    font-weight: 500;
}

.reader-toolbar .btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.reader-toolbar .btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.reader-container {
    position: fixed;
    top: 60px;
    bottom: 80px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
}

.flipbook {
    width: 90%;
    height: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.flipbook .page {
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flipbook .page img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.reader-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.page-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-input {
    width: 80px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    font-size: 1em;
}

.page-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

.zoom-level {
    color: white;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay p {
    color: white;
    font-size: 1.2em;
    margin-top: 20px;
}

.bookmarks-list {
    max-height: 400px;
    overflow-y: auto;
}

.bookmark-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s;
}

.bookmark-item:hover {
    background: #f8f9fa;
}

.bookmark-info {
    flex: 1;
}

.bookmark-page {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.bookmark-note {
    font-size: 0.9em;
    color: #666;
}

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .pdf-item {
        flex-direction: column;
        text-align: center;
    }

    .pdf-actions {
        width: 100%;
        justify-content: center;
    }

    .reader-toolbar {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        padding: 10px;
    }

    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        flex: none;
    }

    .pdf-title {
        max-width: 200px;
    }

    .reader-controls {
        height: auto;
        min-height: 80px;
        flex-wrap: wrap;
        padding: 15px 10px;
    }

    .flipbook {
        width: 95%;
        height: 85%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }

    .pdf-name {
        font-size: 1em;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .reader-container {
        top: 80px;
        bottom: 100px;
    }
}
