/* ============================================================================
   LIBRARY.CSS - OPTIMIZED VERSION
   ============================================================================ */

/* Base Styles */
:root {
    --primary-color: #c0392b;
    --secondary-color: #2c3e50;
    --dark-color: #121212;
    --gray-color: #95a5a6;
    --border-color: #34495e;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: white;
    background-image: url('https://admin.forbiddenexus.com/assets/785ec0d9-d5fb-4946-8de7-3c1c3d631323');
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
}

* {
    box-sizing: border-box;
    margin: 0px;
    padding: 0px;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #a93226;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   LAYOUT - Main Container
   ============================================================================ */

.main-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 100px;
    margin-bottom: 50px;
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
    background-color: rgba(50, 50, 50, 0.8);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
   LIBRARY HEADER
   ============================================================================ */

.library-header {
    margin-bottom: 10px;
    text-align: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.library-title {
    font-size: 2.5rem;
    margin-top: 10px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 500;
}

/* ============================================================================
   CATEGORY FILTERS
   ============================================================================ */

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.filter-btn {
    display: inline-block;
    background-color: transparent;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.filter-btn i {
    margin-right: 5px;
}

/* ============================================================================
   NO BOOKS STATE
   ============================================================================ */

.no-books {
    text-align: center;
    padding: 80px 0;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-bottom: 30px;
    color: white;
}

.no-books i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.no-books h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.no-books p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* ============================================================================
   BOOKS GRID
   ============================================================================ */

.books-grid {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.book-card {
    background-color: transparent;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

/* Book Cover */
.book-cover {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 12px;
    background-color: #222;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
    background-color: #000;
}

.book-card:hover .book-cover img {
    transform: scale(1.02);
}

/* Book Info Overlay */
.book-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 25px 15px 15px 15px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.9) 40%,
        rgba(0, 0, 0, 0.7) 65%,
        rgba(0, 0, 0, 0.4) 80%,
        rgba(0, 0, 0, 0.1) 95%,
        rgba(0, 0, 0, 0) 100%
    );
    transform: translateY(85%);
    opacity: 0;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

.book-card:hover .book-info {
    transform: translateY(0);
    opacity: 1;
}

/* Book Details */
.book-details {
    margin-bottom: 15px;
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: white;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.85rem;
    color: #bbb;
    margin-bottom: 8px;
    line-height: 1.2;
}

.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.book-category {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 8px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
}

.book-language {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 8px;
    background-color: #27ae60;
    color: white;
    border-radius: 10px;
}

/* Book Actions */
.book-overlay {
    margin-top: auto;
}

.book-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.btn-read,
.btn-info {
    flex: 1;
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    text-decoration: none;
}

.btn-read:hover {
    background-color: #3498db;
    border-color: #3498db;
    transform: translateY(-1px);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-info {
    cursor: pointer;
}

.btn-info:hover {
    background-color: #3498db;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.4);
}

/* ============================================================================
   MODAL STYLES
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

/* Modal Animation */
body.modal-open {
    overflow: hidden;
}

.modal-content {
    background-color: var(--dark-color);
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    padding: 30px;
}

.modal-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 5px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.modal-book-details h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.modal-book-details p {
    margin-bottom: 10px;
    color: white;
}

.modal-book-details strong {
    color: var(--primary-color);
}

.modal-book-description {
    margin: 20px 0;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.modal-book-description h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.modal-book-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

.modal-book-actions .btn {
    padding: 12px 20px;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    gap: 15px;
}

.pagination-numbers {
    display: flex;
    gap: 5px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 4px;
    background-color: #2c3e50;
    color: white;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
}

.pagination a:hover:not(.active) {
    background-color: #354b60;
}

.pagination-prev, 
.pagination-next {
    padding: 0 20px !important;
}

.pagination-prev i, 
.pagination-next i {
    font-size: 0.9rem;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 992px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-container {
        margin-top: 100px;
        padding: 20px;
    }
    
    .library-title {
        font-size: 1.8rem;
    }
    
    .library-description {
        font-size: 1rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
    
    .category-filters {
        justify-content: center;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .pagination-numbers {
        display: none;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .book-info {
        padding: 20px 12px 12px 12px;
        min-height: 120px;
        transform: translateY(80%);
    }
    
    .book-details {
        margin-bottom: 12px;
    }
    
    .book-title {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }
    
    .book-author {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .book-language,
    .book-category {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .book-actions {
        gap: 6px;
    }
    
    .btn-read,
    .btn-info {
        padding: 6px 10px;
        font-size: 11px;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .library-title {
        font-size: 1.5rem;
    }
    
    .library-description {
        font-size: 0.9rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .book-info {
        padding: 15px 10px 10px 10px;
        min-height: 100px;
        transform: translateY(75%);
    }
    
    .book-details {
        margin-bottom: 10px;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    .book-author {
        font-size: 0.75rem;
    }
    
    .book-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-read,
    .btn-info {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .modal-book-details h2 {
        font-size: 1.4rem;
    }
}

ul {
    list-style: none;
}
/* ============================================================================
   SCROLLBAR CUSTOMIZATION
   ============================================================================ */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #a93226;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c0392b;
    border-radius: 10px;
    border: 2px solid #a93226;
}

::-webkit-scrollbar-thumb:hover {
    background: #000;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #000 #a93226;
}