/* Books Page Styles */
.books-container {
    padding: 2rem 0;
}

.books-title {
    text-align: center;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    word-break: break-word;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: none;
}

.books-search-container {
    margin: 1.5rem 0 2rem 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0 1.5rem;
}

.books-search-input {
    flex: 1;
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.books-search-clear {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
}

.books-filter-container {
    margin-bottom: 2rem;
    padding: 0 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.books-filter-select {
    flex: 1;
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Style the dropdown options to be more readable */
.books-filter-select option {
    padding: 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    max-width: none;
}

.books-filter-clear {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
}

.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 4px;
    border: none;
    background: #536c83ff;
    color: white;
    cursor: pointer;
    display: none;
}

.books-download-container {
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding: 2rem 1rem;
}

.books-download-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    color: #536c83ff;
    text-decoration: none;
    border: 2px solid #536c83ff;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.books-download-link:hover {
    background: #536c83ff;
    color: white;
    text-decoration: none;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card:hover {
    transform: translateY(-5px);
}

.book-cover {
    height: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    margin-top: 2px;
}

.book-cover-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    display: block;
    margin: 0 auto;
    border: 1px solid black;
}

.book-details {
    padding: 1.5rem;
}

.book-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: #333;
    text-transform: none;
}

.book-author {
    margin: 0 0 1rem 0;
    color: #666;
    font-style: italic;
}

.book-description {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

.book-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #0074D9;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

.book-link:hover {
    background-color: #0056b3;
    text-decoration: none;
    color: white;
}

.book-date {
    color: #888;
    font-size: 0.95em;
    margin-bottom: 0.5em;
}

.book-categories {
    color: #888;
    font-size: 0.95em;
    margin-bottom: 0.5em;
}

.author-link,
.category-link {
    color: #0066cc;
    text-decoration: none;
}

.category-link {
    margin-right: 8px;
}

.book-links {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.book-external-link {
    text-decoration: none;
    color: #0066cc;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
}

.book-external-link img {
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.5rem;
    }
    
    .book-details {
        padding: 1rem;
    }
    
    .book-title {
        font-size: 1.1rem;
        text-transform: none;
    }
    
    .books-search-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .books-filter-container {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .books-filter-select {
        width: 100%;
        min-width: auto;
    }
    
    .books-filter-clear {
        align-self: flex-end;
        width: fit-content;
    }
}

/* Keep clear buttons inline on smaller screens */
@media (max-width: 600px) {
    .books-search-container {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .books-filter-container {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }
    
    .books-filter-select {
        flex: 1;
        min-width: 0;
    }
    
    .books-filter-clear {
        flex-shrink: 0;
        align-self: auto;
        width: auto;
    }
}

@media (max-width: 480px) {
    .books-container {
        padding: 1rem 0;
    }
    
    .books-search-container,
    .books-filter-container {
        padding: 0 1rem;
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .books-filter-select {
        font-size: 0.9rem;
        padding: 0.4rem;
        flex: 1;
        min-width: 0;
    }
    
    .books-filter-clear,
    .books-search-clear {
        flex-shrink: 0;
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
    }
}
