/* FILTER STYLES */

/* Main wrapper for books with filters */
.sukha-books-wrapper {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.sukha-books-wrapper.filter-right {
    flex-direction: row-reverse;
}

/* Filter sidebar */
.sukha-filter-sidebar {
    flex: 0 0 250px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

/* Filter sections */
.filter-section {
    margin-bottom: 2rem;
}

.filter-section:last-child {
    margin-bottom: 1rem;
}

.filter-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

/* Filter options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.filter-options label:hover {
    background-color: #e2e8f0;
}

.filter-options input[type="radio"],
.filter-options input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

/* Filter actions */
.filter-actions {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    margin-top: 1rem;
}

.filter-actions button {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    background: #fff;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-actions button:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Books content area */
.sukha-books-content {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
}

/* Loading states */
.book-grid-container.loading {
    position: relative;
    opacity: 0.6;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-overlay p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* No books state */
.sukha-no-books,
.sukha-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.sukha-no-books p,
.sukha-error p {
    margin: 0;
    font-size: 1.1rem;
}

.sukha-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Mobile filter toggle */
.filter-toggle-btn {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: background-color 0.2s ease;
}

.filter-toggle-btn:hover {
    background: #1d4ed8;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sukha-books-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sukha-books-wrapper.filter-right {
        flex-direction: column;
    }
    
    .sukha-filter-sidebar {
        flex: none;
        position: static;
        margin-bottom: 1rem;
        transition: all 0.3s ease;
    }
    
    .sukha-filter-sidebar.mobile-hidden {
        display: none;
    }
    
    .filter-toggle-btn {
        display: block;
    }
    
    .filter-section h4 {
        font-size: 1rem;
    }
    
    .filter-options {
        gap: 0.5rem;
    }
    
    .filter-options label {
        padding: 0.4rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .sukha-books-wrapper {
        gap: 0.75rem;
    }
    
    .sukha-filter-sidebar {
        padding: 1rem;
        border-radius: 6px;
    }
    
    .filter-section {
        margin-bottom: 1.5rem;
    }
    
    .filter-section h4 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .filter-options label {
        font-size: 0.8rem;
    }
}

/* No filters layout (original grid) */
.sukha-books-wrapper:not(.has-filters) {
    display: block;
}

.sukha-books-wrapper:not(.has-filters) .sukha-books-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Ensure book grid maintains original styling */
.sukha-books-content .book-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 250px);
    gap: 2rem;
    justify-content: flex-start;
}