/* All Books Page Styles */
.allbooks-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Category Filter - THINNER VERSION */
.category-filter {
    background: #f8f9fa;
    padding: 20px 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.books-count {
    background: #3498db;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.category-select-wrapper {
    position: relative;
    max-width: 400px;
}

.category-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 500;
}

.category-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.category-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    pointer-events: none;
    font-size: 0.7rem;
}

.selected-category-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    animation: fadeIn 0.5s ease;
}

.selected-category-info h4 {
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.selected-category-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Books Grid - PROPER 4 COLUMN LAYOUT */
.books-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 40px;
    width: 100%;
}

/* Book Card - FIXED ALIGNMENT */
.book-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #3498db;
}

.book-image {
    position: relative;
    overflow: hidden;
    height: 220px;
    background: #f8f9fa;
    flex-shrink: 0;
}

.book-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.book-card:hover .book-image img {
    transform: scale(1.05);
}

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 2;
    text-transform: uppercase;
}

.book-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #2c3e50;
    text-align: left;
}

.book-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-title a:hover {
    color: #3498db;
}

.book-author {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-style: italic;
    line-height: 1.4;
    text-align: left;
}

.book-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    text-align: left;
}

.current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #27ae60;
}

.original-price {
    font-size: 0.9rem;
    color: #95a5a6;
    text-decoration: line-through;
    font-weight: 500;
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    text-align: left;
}

.stars {
    color: #f39c12;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.rating-count {
    color: #7f8c8d;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-rating {
    color: #bdc3c7;
    font-size: 0.8rem;
    font-style: italic;
}

.book-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    text-align: center;
}

.view-details-btn {
    width: 100%;
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: block;
}

.view-details-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    color: white;
    text-decoration: none;
}

/* Pagination Styles */
.allbooks-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    padding: 30px 0;
    border-top: 1px solid #e9ecef;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.pagination-btn:hover:not(:disabled) {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #bdc3c7;
    color: #bdc3c7;
    transform: none;
}

.pagination-numbers {
    display: flex;
    gap: 6px;
}

.pagination-number {
    padding: 10px 15px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

.pagination-number:hover,
.pagination-number.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-info {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-left: 20px;
    font-weight: 500;
}

/* Loading State */
.books-loading {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
    grid-column: 1 / -1;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.books-loading p {
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* No Books State */
.no-books {
    text-align: center;
    padding: 80px 20px;
    color: #7f8c8d;
    grid-column: 1 / -1;
}

.no-books h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #2c3e50;
    font-weight: 600;
}

.no-books p {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .category-filter {
        padding: 15px 20px;
    }
    
    .book-image {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .allbooks-container {
        padding: 15px;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .category-filter {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .filter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .book-info {
        padding: 15px;
    }
    
    .book-title {
        font-size: 1rem;
    }
    
    .allbooks-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .pagination-info {
        margin-left: 0;
        margin-top: 10px;
        flex-basis: 100%;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .books-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .book-image {
        height: 180px;
    }
    
    .book-actions {
        flex-direction: column;
    }
    
    .category-select-wrapper {
        max-width: 100%;
    }
    
    .pagination-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Extra large screens */
@media (min-width: 1400px) {
    .allbooks-container {
        max-width: 1600px;
    }
    
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .book-image {
        height: 240px;
    }
}

/* Focus styles for accessibility */
.book-card:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

button:focus,
select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Pulse animation for count updates */
.pulse {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}