* {
    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;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.search-bar {
    display: flex;
    gap: 10px;
    max-width: 500px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
}

.search-bar button {
    padding: 10px 25px;
    background: #fff;
    color: #667eea;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.search-bar button:hover {
    transform: translateY(-2px);
}

main {
    display: flex;
    gap: 20px;
    margin: 2rem auto;
}

.sidebar {
    width: 200px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.category-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s;
}

.category-btn:hover {
    background: #e9ecef;
}

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

.content {
    flex: 1;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.book-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.book-cover {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #e9ecef;
}

.book-info {
    padding: 15px;
}

.book-title {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-author {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.book-category {
    display: inline-block;
    padding: 3px 10px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 12px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 2rem;
}

.pagination button {
    padding: 8px 15px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #667eea;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.book-detail-content {
    display: flex;
    gap: 20px;
}

.book-detail-cover {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 5px;
}

.book-detail-info h2 {
    margin-bottom: 15px;
    color: #667eea;
}

.book-detail-info p {
    margin-bottom: 10px;
    line-height: 1.8;
}

.book-detail-info strong {
    color: #666;
}

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .book-detail-content {
        flex-direction: column;
    }
}
