/* Recent Posts Grid - Based on 2nd.html design with renamed classes */

/* Container and Basic Layout */
.recent-posts-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.recent-posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #20c997;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.recent-posts-header h2 {
    font-size: 1.2em;
    font-weight: bold;
}

.recent-posts-view-all {
    background-color: #e9ecef;
    color: #333;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.recent-posts-view-all:hover {
    background-color: #dee2e6;
}

/* Video Grid */
.recent-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px 20px;
}

/* Individual Video Item */
.recent-post-item {
    background-color: #fff;
    max-height: 120px !important;
    max-width: 185px !important;
}

/* Thumbnail */
.recent-post-thumbnail {
    position: relative;
    background-color: #000;
    aspect-ratio: 16 / 9;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Disable default pseudo-element play overlay */
.recent-post-thumbnail::after,
.recent-post-thumbnail:hover::after {
    display: none;
}

/* Add play icon overlay behavior */
.recent-post-play-icon {
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3; /* ensure above image */
    pointer-events: none; /* allow hover through icon */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}
.recent-post-thumbnail:hover .recent-post-play-icon {
    opacity: 1;
}

.recent-post-play-icon svg {
    width: 20px;
    height: 20px;
}

/* Inline SVG play icon styling */
/*
.recent-post-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 1 !important;
    transition: opacity 0.3s ease;
    z-index: 4;
}
.recent-post-thumbnail:hover .recent-post-play-icon {
    opacity: 1;
}
*/

/* Zoom thumbnail image smoothly and darken on hover */
.recent-post-thumbnail .recent-post-image {
    transition: transform 1s ease, filter 0.3s ease;
}
.recent-post-thumbnail:hover .recent-post-image {
    transform: scale(1.1);
    filter: brightness(0.7);
}

/* Center and hide play icon by default */
.recent-post-thumbnail .recent-post-placeholder-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}
/* Show play icon on hover */
.recent-post-thumbnail:hover .recent-post-placeholder-icon {
    opacity: 1;
}

.recent-post-placeholder-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    opacity: 0.5;
    background-size: contain;
}

.recent-post-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Base Badge Style */
.recent-post-badge {
    position: absolute;
    padding: 4px 8px;
    font-size: 0.75em;
    font-weight: bold;
    color: white;
    line-height: 1.3;
    text-transform: uppercase;
}

/* Type Badge (Top Right) */
.recent-post-type {
    top: 10px;
    right: 10px;
    border-radius: 3px;
}

/* Specific colors for Type Badge */
.recent-post-type.drama { background-color: #17a2b8; }
.recent-post-type.movie { background-color: var(--theme-color-main, #20c997); }

/* Episode Badge (Bottom Left - Slanted Right Edge) */
.recent-post-episode {
    bottom: 10px;
    left: 10px;
    background-color: #17a2b8;
    clip-path: polygon(0% 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    padding-right: 12px;
}

/* Sub/RAW/Dub Badge (Bottom Right - Slanted Left Edge + Rounded Right) */
.recent-post-language {
    bottom: 10px;
    right: 10px;
    clip-path: polygon(10px 0%, 100% 0%, 100% 100%, 0% 100%);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    padding-left: 12px;
}

/* Specific colors for Sub/RAW/Dub Badge */
.recent-post-language.sub { background-color: #ffc107; color: #333; }
.recent-post-language.raw { background-color: #fd7e14; color: white; }
.recent-post-language.dub { background-color: var(--theme-color-main, #20c997); color: white; }

/* Video Title */
.recent-post-title {
    font-size: 0.9em;
    color: #333;
    margin-top: 8px;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .recent-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .recent-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .recent-posts-header h2 {
        font-size: 1em;
    }
    .recent-posts-view-all {
        font-size: 0.7em;
        padding: 5px 8px;
    }
    .recent-post-title {
        font-size: 0.85em;
    }
}

@media (max-width: 576px) {
    .recent-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .recent-posts-header {
        padding: 8px 10px;
    }
    .recent-posts-header h2 {
        font-size: 0.9em;
    }
    .recent-posts-view-all {
        font-size: 0.65em;
        padding: 4px 6px;
    }
    .recent-post-item {
        max-height: 120px !important;
        max-width: 150px !important;
    }
}

/* Dark mode support */
.dark .recent-post-item {
    background-color: #1f2937;
    height: 120px !important;
    width: 185px !important;
}

.dark .recent-post-title {
    color: #e5e7eb;
}

/* V2 Pagination - Improved Styling and Centering */
.recent-posts-section .pagination {
    margin: 2rem auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
    padding: 0 15px;
}

.recent-posts-section .pagination .page-numbers {
    display: inline-flex;
    align-items: center; 
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 4px;
    background-color: var(--pagination-bg-color, #edf2f7);
    color: var(--pagination-text-color, #4a5568);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid var(--pagination-border-color, #e2e8f0);
}

.recent-posts-section .pagination .page-numbers:hover {
    background-color: var(--pagination-hover-bg-color, #e2e8f0);
    color: var(--pagination-hover-text-color, #2d3748);
}

.recent-posts-section .pagination .page-numbers.current {
    background-color: var(--pagination-current-bg-color, #20c997);
    color: var(--pagination-current-text-color, #ffffff);
    border-color: var(--pagination-current-border-color, #20c997);
}

.recent-posts-section .pagination .page-numbers.prev,
.recent-posts-section .pagination .page-numbers.next {
    width: auto;
    padding: 0 15px;
}

/* Support for both direct page numbers and list-based pagination */
.recent-posts-section .pagination ul.page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.recent-posts-section .pagination ul.page-numbers li {
    margin: 0 4px;
}

.recent-posts-section .pagination ul.page-numbers li .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background-color: var(--pagination-bg-color, #edf2f7);
    color: var(--pagination-text-color, #4a5568);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    border: 1px solid var(--pagination-border-color, #e2e8f0);
}

.recent-posts-section .pagination ul.page-numbers li .page-numbers:hover {
    background-color: var(--pagination-hover-bg-color, #e2e8f0);
    color: var(--pagination-hover-text-color, #2d3748);
}

.recent-posts-section .pagination ul.page-numbers li .page-numbers.current {
    background-color: var(--pagination-current-bg-color, #20c997);
    color: var(--pagination-current-text-color, #ffffff);
    border-color: var(--pagination-current-border-color, #20c997);
}

/* Fix Prev/Next button width in list-based pagination */
.recent-posts-section .pagination ul.page-numbers li .page-numbers.prev,
.recent-posts-section .pagination ul.page-numbers li .page-numbers.next {
    width: auto;
    padding: 0 15px;
}

/* Dark mode support */
.dark .recent-posts-section .pagination .page-numbers {
    background-color: var(--pagination-dark-bg-color, #2d3748);
    color: var(--pagination-dark-text-color, #e2e8f0);
    border-color: var(--pagination-dark-border-color, #4a5568);
}

.dark .recent-posts-section .pagination .page-numbers:hover {
    background-color: var(--pagination-dark-hover-bg-color, #4a5568);
    color: var(--pagination-dark-hover-text-color, #ffffff);
}

.dark .recent-posts-section .pagination .page-numbers.current {
    background-color: var(--pagination-dark-current-bg-color, #20c997);
    color: var(--pagination-dark-current-text-color, #ffffff);
    border-color: var(--pagination-dark-current-border-color, #20c997);
}