/* Scientific Books Manager - Public Styles (RTL) */

.sbm-books-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: "Tajawal", "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    direction: rtl;
    text-align: right;
}

/* Layout */
.sbm-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.sbm-main {
    width: calc(70% - 30px);
    flex-shrink: 0;
    min-width: 0; /* Prevent flex blowout */
}

.sbm-sidebar {
    width: 30%;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* Mobile Top Section */
.sbm-mobile-top {
    margin-bottom: 25px;
}

.sbm-mobile-only {
    display: none;
}
.sbm-desktop-only {
    display: block;
}

/* Search Header */
.sbm-desktop-search {
    padding: 20px 20px 0 20px;
}

.sbm-search-box {
    display: flex;
    gap: 10px;
    width: 100%;
}

.sbm-search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.sbm-search-box input:focus {
    outline: none;
    border-color: #0B4060;
}

.sbm-btn {
    padding: 12px 24px;
    background: #0B4060;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.sbm-btn:hover {
    background: #083048;
}

.sbm-btn:active {
    transform: scale(0.98);
}

.sbm-btn-block {
    display: block;
    width: 100%;
    margin-top: 15px;
}

/* Sidebar Filters */
.sbm-filters-inner {
    padding: 20px;
}

.sbm-filter-section {
    margin-bottom: 25px;
}

.sbm-filter-heading {
    font-size: 18px;
    margin: 0 0 15px 0;
    color: #212529;
    font-weight: 700;
}

.sbm-filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sbm-categories-scroll {
    max-height: 250px; /* roughly 8 items */
    overflow-y: auto;
    padding-left: 10px; /* space for scrollbar on left in RTL */
}

/* Custom Scrollbar for categories */
.sbm-categories-scroll::-webkit-scrollbar {
    width: 6px;
}
.sbm-categories-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.sbm-categories-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1; 
    border-radius: 4px;
}
.sbm-categories-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; 
}

.sbm-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 15px;
    color: #495057;
}

.sbm-checkbox input {
    margin-top: 3px;
    margin-left: 10px; /* Arabic RTL */
    margin-right: 0;
    width: 16px;
    height: 16px;
    accent-color: #0B4060;
    flex-shrink: 0;
}

/* Books Grid */
.sbm-books-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* Book Card Design (Matching Image) */
.sbm-book-card {
    background: #0B4060; /* Dark blue background */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.sbm-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(11, 64, 96, 0.2);
}

.sbm-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sbm-book-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1.1;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbm-book-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keep the entire cover visible like the image */
    background: #fff;
    padding: 15px; /* Padding so it looks like a book inside a frame */
}

.sbm-book-thumbnail.sbm-no-image {
    background: #fff;
}

.sbm-no-image .dashicons {
    font-size: 80px;
    color: #ccc;
    width: auto;
    height: auto;
}

.sbm-book-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
    align-items: center;
    justify-content: space-between;
}

.sbm-book-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #fff; /* White text on blue background */
    line-height: 1.4;
}

.sbm-book-download {
    display: inline-block;
    padding: 8px 24px;
    background: transparent;
    color: #fff;
    text-decoration: none;
    border: 2px solid #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 10px; /* Push to bottom */
}

.sbm-book-download:hover {
    background: #fff;
    color: #0B4060;
}

/* Loading & Empty States */
.sbm-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
}

.sbm-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
    grid-column: 1 / -1;
}

/* Numbered Pagination */
.sbm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
    direction: ltr; /* keep pagination numbers left to right usually */
}

.sbm-page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #0B4060;
    border: 2px solid #0B4060;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 12px;
}

.sbm-page-btn:hover:not(.sbm-page-active) {
    background: rgba(11, 64, 96, 0.05);
    border-color: #0B4060;
}

.sbm-page-btn.sbm-page-active {
    background: #0B4060;
    color: #fff;
    border-color: #0B4060;
    cursor: default;
}

.sbm-page-dots {
    color: #6c757d;
    padding: 0 4px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 992px) {
    .sbm-books-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablet */
    }
}

@media (max-width: 768px) {
    .sbm-layout {
        flex-direction: column;
        gap: 0;
    }
    
    .sbm-sidebar {
        width: 100%;
        display: none; /* Hidden by default on mobile, toggled via JS */
        margin-bottom: 25px;
    }
    
    .sbm-sidebar.sbm-active {
        display: block;
    }

    .sbm-main {
        width: 100%;
    }

    .sbm-mobile-only {
        display: block;
    }
    .sbm-desktop-only {
        display: none;
    }
    
    .sbm-books-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
    }
}
