/**
 * Jamia Hanfia Books Library - Frontend Styles
 * Modern Islamic Educational Design
 */

/* Container */
.jamia-books-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Poppins', Roboto, sans-serif;
}

/* Header Section */
.jamia-books-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.jamia-books-header::after {
    content: "﴿";
    font-family: serif;
    font-size: 40px;
    color: rgba(47, 181, 0, 0.1);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.jamia-books-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1a472a, #2fb500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.jamia-books-subtitle {
    color: #666;
    font-size: 1.1rem;
}

.jamia-books-stats {
    text-align: right;
    margin-bottom: 20px;
    padding: 8px 15px;
    background: #f5f5f5;
    border-radius: 30px;
    display: inline-block;
    font-size: 14px;
    color: #2fb500;
    font-weight: 500;
}

/* Grid Layout */
.jamia-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Book Card */
.book-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2fb500, #1a472a);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.book-card:hover::before {
    transform: scaleX(1);
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.15);
}

.book-card-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Book Cover */
.book-cover {
    position: relative;
    background: linear-gradient(135deg, #0d2b1a, #1a472a);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-pages-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    color: white;
    padding: 5px 12px;
    border-radius: 25px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Book Info */
.book-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a2e;
    line-height: 1.4;
}

.book-author {
    font-size: 0.85rem;
    color: #2fb500;
    font-weight: 500;
    margin: 0 0 10px 0;
}

.book-language-badge {
    display: inline-block;
    font-size: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    width: fit-content;
    font-weight: 500;
}

.lang-urdu {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
}

.lang-english {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
}

.lang-arabic {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #e65100;
}

.lang-both {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #6a1b9a;
}

.book-description {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #555;
    margin: 0 0 20px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Action Buttons */
.book-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.btn-read-online,
.btn-download {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-read-online {
    background: linear-gradient(135deg, #2fb500, #239000);
    color: white;
    box-shadow: 0 4px 10px rgba(47, 181, 0, 0.3);
}

.btn-read-online:hover {
    background: linear-gradient(135deg, #239000, #1a7000);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(47, 181, 0, 0.4);
}

.btn-download {
    background: transparent;
    color: #2fb500;
    border: 2px solid #2fb500;
}

.btn-download:hover {
    background: #2fb500;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(47, 181, 0, 0.2);
}

/* PDF Modal */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pdf-modal-content {
    background: #1a1a2e;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pdf-modal-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #2fb500;
}

.pdf-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.pdf-modal-close {
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.pdf-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.pdf-modal-body {
    flex: 1;
    background: #525659;
}

.pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-modal-footer {
    padding: 12px 24px;
    background: #0f0f1a;
    text-align: right;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-download-modal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #2fb500, #239000);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-download-modal:hover {
    background: linear-gradient(135deg, #239000, #1a7000);
    transform: translateY(-2px);
    color: white;
}

/* Empty State */
.jamia-books-empty {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border-radius: 24px;
    color: #666;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.jamia-books-empty h3 {
    color: #333;
    margin-bottom: 10px;
}

/* Pagination */
.jamia-books-pagination {
    text-align: center;
    margin-top: 30px;
}

.jamia-books-pagination .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 5px;
    background: #f5f5f5;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.jamia-books-pagination .page-numbers.current {
    background: linear-gradient(135deg, #2fb500, #239000);
    color: white;
}

.jamia-books-pagination .page-numbers:hover:not(.current) {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .jamia-books-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .jamia-books-title {
        font-size: 1.8rem;
    }
    
    .pdf-modal-content {
        width: 95%;
        height: 85%;
    }
    
    .book-cover img {
        height: 240px;
    }
}

@media (max-width: 480px) {
    .book-actions {
        flex-direction: column;
    }
    
    .btn-read-online,
    .btn-download {
        width: 100%;
    }
    
    .jamia-books-wrapper {
        padding: 20px 15px;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.book-card.loading {
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #2fb500, #1a472a);
    border-radius: 10px;
}