body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

header {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-top {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header-logo-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.site-title {
    font-size: 32px;
    font-weight: 400;
    font-family: 'Georgia', serif;
    color: #333;
    margin: 0;
    letter-spacing: -0.5px;
}

.site-subtitle {
    font-size: 16px;
    color: #6c757d;
    margin: 0;
    font-style: italic;
    font-weight: 400;
}

.header-nav {
    background-color: #f8f9fa;
    border-top: 3px solid #dc3545;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover {
    background-color: #e9ecef;
    color: #003d7a;
}

.nav-link.active {
    background-color: #003d7a;
    color: #fff;
    border-bottom-color: #dc3545;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.controls {
    background-color: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-top: 3px solid #dc3545;
}

.filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

@media (max-width: 992px) {
    .filters-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-input-container {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.search-suggestion {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.search-suggestion:hover,
.search-suggestion.highlighted {
    background-color: #f8f9fa;
}

.search-suggestion:last-child {
    border-bottom: none;
}

.suggestion-type {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 500;
    margin-left: 8px;
}

.filter-section label {
    font-weight: 600;
    color: #003d7a;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-section select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-width: 180px;
    transition: all 0.2s ease;
}

.filter-section select:focus {
    outline: none;
    border-color: #003d7a;
    box-shadow: 0 0 0 3px rgba(0, 61, 122, 0.1);
}

.search-section input {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-width: 250px;
    transition: all 0.2s ease;
}

.search-section input:focus {
    outline: none;
    border-color: #003d7a;
    box-shadow: 0 0 0 3px rgba(0, 61, 122, 0.1);
}

.search-section input::placeholder {
    color: #999;
    font-style: italic;
}

.reset-section {
    align-self: end;
}

.reset-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.reset-icon {
    font-size: 16px;
    font-weight: bold;
}

.reset-button:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.reset-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

.filter-chips-container {
    margin-bottom: 20px;
    min-height: 0;
    transition: all 0.3s ease;
}

.filter-chips-container.hidden {
    display: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #003d7a, #002855);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 61, 122, 0.2);
}

.filter-chip:hover {
    background: linear-gradient(135deg, #002855, #001a3d);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 61, 122, 0.3);
}

.filter-chip-remove {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.results-header {
    padding: 12px 0;
    border-top: 1px solid #e9ecef;
}

.results-count {
    color: #003d7a;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

@media (max-width: 768px) {
    .header-content {
        padding: 15px;
    }
    
    .site-title {
        font-size: 24px;
    }
    
    .site-subtitle {
        font-size: 14px;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .nav-link {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    main {
        padding: 20px 15px;
    }
    
    .controls {
        padding: 20px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: left;
    }
    
    .reset-section {
        align-self: stretch;
    }
    
    .reset-button {
        width: 100%;
        justify-content: center;
    }
    
    .filter-section select,
    .search-section input {
        width: 100%;
        max-width: 100%;
    }
    
    .book-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

.book-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    width: 100%;
}

.book-card {
    position: relative;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    height: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid #e9ecef;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #003d7a;
}

.book-card-image {
    width: 100%;
    aspect-ratio: 2/3; /* book-like proportions */
    object-fit: cover;
    display: block;
}

.book-card-info {
    padding: 12px;
    background: white;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 16px;
    font-weight: 600;
    color: #003d7a;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.book-author {
    font-size: 14px;
    color: #6c757d;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.book-genre-badge {
    font-size: 12px;
    color: #003d7a;
    background: #e8f0ff;
    padding: 4px 12px;
    border-radius: 4px;
    display: inline-block;
    align-self: flex-start;
    margin-top: auto;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    aspect-ratio: 2/3;
    background-color: rgba(0, 61, 122, 0.95);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.book-card-image:hover + .book-card-overlay,
.book-card-overlay:hover {
    opacity: 1;
}

.book-overlay-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: #fff;
}

.book-overlay-author,
.book-overlay-genre {
    margin: 0 0 8px 0;
    font-size: 14px;
    opacity: 0.9;
}

.book-overlay-author strong,
.book-overlay-genre strong {
    font-weight: bold;
}

.book-description {
    margin: 10px 0 0 0;
    font-size: 13px;
    line-height: 1.4;
    flex-grow: 1;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    background-color: #fee;
    color: #c00;
    border-radius: 8px;
    margin: 20px 0;
}

/* Loading states */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #4a4e69;
}

/* Skeleton loading cards */
.skeleton-card {
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    height: auto;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-top: 3px solid #dc3545;
}

.skeleton-title {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-author {
    height: 16px;
    width: 70%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-genre {
    height: 20px;
    width: 40%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 10px;
    margin-top: auto;
    align-self: flex-start;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Image loading states */
.book-card-image {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    position: relative;
    transition: opacity 0.3s ease;
}

.book-card-image.loading {
    opacity: 0;
}

.book-card-image.loaded {
    opacity: 1;
}

.book-card-image.error {
    opacity: 1;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    border: 2px dashed #dee2e6;
}

/* Loading spinner overlay */
.image-loading-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    z-index: 2;
    pointer-events: none;
}

.loading-spinner::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #003d7a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state for missing images */
.book-cover-error {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    text-align: center;
    padding: 20px;
    border: 2px dashed #dee2e6;
    font-size: 14px;
    line-height: 1.4;
}

.book-cover-error-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.book-cover-error-text {
    font-weight: 500;
    margin-bottom: 4px;
}

.book-cover-error-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0 20px 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 10px 20px;
    background-color: #003d7a;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-btn:hover:not(:disabled) {
    background-color: #002855;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-btn:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-numbers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.page-number {
    padding: 8px 12px;
    background-color: #fff;
    color: #003d7a;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background-color: #e8f0ff;
    color: #003d7a;
    border-color: #003d7a;
}

.page-number.active {
    background-color: #003d7a;
    color: white;
    border-color: #003d7a;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #666;
    font-size: 14px;
}

@media (max-width: 768px) {
    .pagination {
        gap: 5px;
    }
    
    .page-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .page-number {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
    }
}

/* Scrollbar styling */
.book-card-overlay::-webkit-scrollbar {
    width: 6px;
}

.book-card-overlay::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.book-card-overlay::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Additional LCHS-style enhancements */
.book-card-info {
    padding: 16px;
    background: white;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-top: 3px solid #dc3545;
}

/* Add subtle animation to page load */
.book-card {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Style adjustments for better LCHS integration */

/* Footer-like section for pagination */
.pagination {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}