/* ========================================
   E-BOOK GALLERY STYLES
   Document Section Premium Design
   ======================================== */

/* ========================================
   1. SECTION BACKGROUND
   ======================================== */

/* Animated gradient background for Document section */
.document-section {
    background: linear-gradient(135deg,
            #5e1914 0%,
            #8B2500 25%,
            #A0522D 50%,
            #ddc656 75%,
            #f4e4a6 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
}

/* Overlay to soften the gradient */
.document-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 0;
}

.document-section>* {
    position: relative;
    z-index: 1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ========================================
   2. HEADING STYLES
   ======================================== */

/* Text gradient for main heading */
.document-heading {
    background: linear-gradient(135deg, #5e1914 0%, #8B2500 50%, #ddc656 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(94, 25, 20, 0.3);
    animation: headingPulse 3s ease-in-out infinite;
}

@keyframes headingPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.9;
    }
}

/* ========================================
   3. E-BOOK CARD STYLES
   ======================================== */

.ebook-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ebook-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(94, 25, 20, 0.25),
        0 0 30px rgba(221, 198, 86, 0.3);
}

/* ========================================
   4. COVER IMAGE STYLES
   ======================================== */

.ebook-cover-wrapper {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    aspect-ratio: 3/4;
}

.ebook-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ebook-card:hover .ebook-cover {
    transform: scale(1.05);
}

/* ========================================
   5. OVERLAY & BUTTON
   ======================================== */

.ebook-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(94, 25, 20, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ebook-card:hover .ebook-overlay {
    opacity: 1;
}

.ebook-btn {
    background: linear-gradient(135deg, #ddc656 0%, #f4e4a6 100%);
    color: #5e1914;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(221, 198, 86, 0.4);
    transform: translateY(10px);
}

.ebook-overlay:hover .ebook-btn {
    transform: translateY(0);
}

.ebook-btn:hover {
    background: linear-gradient(135deg, #f4e4a6 0%, #ddc656 100%);
    box-shadow: 0 8px 25px rgba(221, 198, 86, 0.6);
    transform: scale(1.05);
}

.ebook-btn i {
    margin-right: 8px;
}

/* ========================================
   6. INFO SECTION STYLES
   ======================================== */

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

.ebook-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5e1914;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ebook-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ebook-views {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #999;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.ebook-views i {
    color: #ddc656;
    font-size: 1.1rem;
}

.ebook-views span {
    font-weight: 600;
    color: #5e1914;
}

/* ========================================
   7. MODAL STYLES
   ======================================== */

.modal-content {
    border-radius: 15px;
    overflow: hidden;
    border: none;
}

.modal-header {
    background: linear-gradient(135deg, #5e1914 0%, #8B2500 100%);
    color: white;
    border-bottom: none;
    padding: 20px 25px;
}

.modal-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i {
    font-size: 1.3rem;
}

.modal-body iframe {
    border: none;
    width: 100%;
    min-height: 600px;
}

.modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 15px 25px;
}

.modal-footer .me-auto {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.95rem;
}

.modal-footer .me-auto i {
    color: #ddc656;
}

.modal-footer .me-auto span {
    font-weight: 600;
    color: #5e1914;
}

/* ========================================
   8. ANIMATIONS
   ======================================== */

/* Fade in animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for view count */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.ebook-views span {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   9. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 992px) {
    .ebook-title {
        font-size: 1rem;
    }

    .ebook-description {
        font-size: 0.85rem;
    }

    .modal-body iframe {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .ebook-card {
        margin-bottom: 20px;
    }

    .ebook-overlay {
        opacity: 0.95;
    }

    .ebook-btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }

    .modal-body iframe {
        min-height: 400px;
    }

    .document-heading {
        font-size: 2rem !important;
    }
}

@media (max-width: 576px) {
    .ebook-info {
        padding: 15px;
    }

    .ebook-title {
        font-size: 0.95rem;
        min-height: auto;
    }

    .ebook-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }

    .modal-body iframe {
        min-height: 300px;
    }
}

/* ========================================
   10. ACCESSIBILITY
   ======================================== */

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    .ebook-card,
    .ebook-cover,
    .ebook-btn,
    .ebook-overlay,
    .document-section {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus styles for keyboard navigation */
.ebook-btn:focus,
.modal .btn-close:focus {
    outline: 3px solid #ddc656;
    outline-offset: 2px;
}

/* ========================================
   11. LOADING STATE (for future use)
   ======================================== */

.ebook-card.loading .ebook-cover-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   12. CAROUSEL NAVIGATION
   ======================================== */

/* Carousel wrapper */
.ebook-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

/* Navigation arrows */
.ebook-carousel-prev,
.ebook-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5e1914 0%, #8B2500 100%);
    color: white;
    border: none;
    display: none;
    /* Hidden by default, shown by JS when needed */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(94, 25, 20, 0.3);
}

.ebook-carousel-prev {
    left: -25px;
}

.ebook-carousel-next {
    right: -25px;
}

.ebook-carousel-prev:hover,
.ebook-carousel-next:hover {
    background: linear-gradient(135deg, #8B2500 0%, #5e1914 100%);
    box-shadow: 0 6px 20px rgba(94, 25, 20, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.ebook-carousel-prev:disabled,
.ebook-carousel-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #ccc;
}

.ebook-carousel-prev i,
.ebook-carousel-next i {
    font-size: 1.5rem;
}

/* Carousel dots */
.ebook-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    border: 2px solid #5e1914;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background: #ddc656;
    transform: scale(1.2);
}

.carousel-dot.active {
    background: linear-gradient(135deg, #5e1914 0%, #ddc656 100%);
    width: 30px;
    border-radius: 6px;
}

/* Responsive carousel navigation */
@media (max-width: 992px) {
    .ebook-carousel-prev {
        left: -15px;
    }

    .ebook-carousel-next {
        right: -15px;
    }

    .ebook-carousel-prev,
    .ebook-carousel-next {
        width: 40px;
        height: 40px;
    }

    .ebook-carousel-prev i,
    .ebook-carousel-next i {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {

    .ebook-carousel-prev,
    .ebook-carousel-next {
        width: 35px;
        height: 35px;
        opacity: 0.9;
    }

    .ebook-carousel-prev {
        left: 5px;
    }

    .ebook-carousel-next {
        right: 5px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }

    .carousel-dot.active {
        width: 25px;
    }
}