/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

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

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

/* Header Styles */
.header {
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo img {
    height: 50px;
    width: auto;
}

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

.search-container {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 600px;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

/* Category Section */
.category-section {
    margin-bottom: 40px;
}

.category-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background-color: var(--surface);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* Books Section */
.books-section {
    margin-bottom: 40px;
}

.results-info {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

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

.book-card {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

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

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 15px;
    background-color: var(--background);
}

.book-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-summary {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.no-results {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

/* Pagination */
.pagination-section {
    margin-bottom: 40px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.page-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Footer */
.footer {
    background-color: var(--surface);
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }

    .search-container {
        width: 100%;
        max-width: 100%;
    }

    .logo h1 {
        font-size: 20px;
    }

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

    .category-buttons {
        max-height: 200px;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .book-card {
        padding: 10px;
    }

    .book-title {
        font-size: 14px;
    }

    .book-summary,
    .book-author {
        font-size: 12px;
    }
}
