/* Enhanced Infinite Scroll Styles */
.videos-container {
    position: relative;
    min-height: 300px;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 20px;
    width: 100%;
    height: 100px; /* Increased height for better visibility */
    margin: 20px 0;
}

.loading-spinner i {
    font-size: 40px;
    color: var(--white);
    animation: spin 1s infinite linear;
}

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

/* Scroll Trigger Enhancement */
.scroll-trigger {
    width: 100%;
    height: 200px; /* Much taller for easier detection */
    position: relative;
    visibility: hidden;
    background: transparent;
}

/* Improved Video Modal Styles */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 1000px;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.modal-video-container {
    position: relative;
    width: 100%;
    padding-top: 15%; /* 16:9 Aspect Ratio */
}

.modal-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    background: rgba(0,0,0,0.7);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-modal:hover {
    background: rgba(255,0,0,0.2);
}

/* Improved Video Card Styles */
.video-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.video-clickable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.video-clickable:hover::after {
    opacity: 1;
}

/* New Category and Tag Card Styles */
.category-tag-grid,
.info-card {
    height: 100%;
    background-color: var(--light-navy);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.info-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
}

.info-card i {
    color: var(--white);
    margin-bottom: 1rem;
}

.info-card h3 {
    margin-bottom: 0.75rem;
    color: var(--white);
}

.info-card-description {
    color: var(--light-gray);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.info-card .btn {
    margin-top: auto;
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background-color: var(--red);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: bold;
}

.info-card .btn:hover {
    background-color: #c0392b;
}

/* Search Highlight Style */
.highlight {
    background-color: #2d5da8;
    color: white;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* Related Videos Section */
.related-videos {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-navy);
}

.section-title {
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: var(--red);
    margin: 0.5rem auto 5px;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .featured-video {
        background-color: var(--light-navy);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 1.5rem;
    }
    
    .featured-video-container {
        height: auto;
        aspect-ratio: 16 / 9;
    }
    
    /* Optimize loading indicators for mobile */
    .loading-spinner {
        height: 80px;
    }
    
    .scroll-trigger {
        height: 100px;
    }
    
    /* Ensure proper text contrast on mobile */
    .video-title, .video-description {
        color: var(--white) !important;
    }
    
    .video-title-link h3, .video-title-link p {
        color: var(--white) !important;
    }
}

/* Enhanced status messages */
.status-message {
    text-align: center;
    padding: 1rem;
    margin: 1.5rem 0;
    background-color: var(--light-navy);
    border-radius: 8px;
    color: var(--white);
    font-weight: bold;
}

.end-of-content {
    text-align: center;
    padding: 2rem 1rem;
    margin: 1.5rem 0;
    background-color: var(--light-navy);
    border-radius: 8px;
}

.end-of-content h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.end-of-content p {
    color: var(--light-gray);
    margin-bottom: 1.5rem;
}

.end-of-content .btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--red);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.end-of-content .btn:hover {
    background-color: #c0392b;
}


/* Books Grid Styles */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.book-card {
    /* background-color: var(--white); */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.book-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.book-thumbnail img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    transition: transform 0.3s;
}

.book-card:hover .book-thumbnail img {
    transform: scale(1.05);
}

.book-details {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: var(--gray);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.6);
    padding: 5px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.book-pages {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    color: white;
}

.bestseller-badge {
    background: #ab0000;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.85rem;
}

.book-info {
    padding: 1rem;
    background: var(--white);
    min-height: 240px;
}

.book-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.3;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author-name {
    font-size: 0.95rem;
    color: var(--light-gray);
    margin-bottom: 0.75rem;
}

.book-description {
    color: var(--light-gray);
    font-size: 0.9rem;
    line-height: 1.5;
    /* Limit to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.amazon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ff9900;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s;
}

.amazon-link:hover {
    color: #cc7a00;
}

.amazon-link i {
    font-size: 1.3rem;
}