/* ==========================================================
   TPG Dynamic Blog Grid - Stylesheet
   ========================================================== */

/* --- Horizontal Scrollable Categories Nav --- */
.tpg-category-outer {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Contains the scroll area strictly inside the widget */
}

.tpg-category-nav-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.tpg-category-nav-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tpg-category-nav {
    display: flex;
    gap: 15px;
    list-style: none;
    padding: 0 20px 0 0; /* Extra right padding so text clears the arrow */
    margin: 0;
    white-space: nowrap;
}

.tpg-cat-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

/* Active state fallback - Elementor handles the active state color via widget settings */
.tpg-cat-btn.active {
    font-weight: bold;
}

/* Scroll Arrow Indicator */
.tpg-scroll-arrow {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 5px 0 35px;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, #ffffff 45%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 20px;
    font-weight: bold;
    color: #333; /* Default arrow color */
}

.tpg-scroll-arrow.is-visible {
    opacity: 1;
}

/* --- Secondary Dropdowns --- */
.tpg-sub-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tpg-filter-dropdown {
    padding: 8px 12px;
    border: 1px solid #ccc; /* Overridden by Elementor */
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

/* --- CSS Grid for Posts --- */
.tpg-post-grid {
    display: grid;
    --tpg-cols: 3; /* Fallback, Elementor overrides this */
    grid-template-columns: repeat(var(--tpg-cols), 1fr);
    gap: 30px;
    transition: opacity 0.3s ease-in-out;
}

/* --- Card Styling --- */
.tpg-post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensures borders round nicely */
    background-color: #fff; /* Base background */
    transition: all 0.3s ease;
}

/* 16:10 Image Aspect Ratio */
.tpg-post-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f0f0f0;
}

.tpg-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Hover effect on image */
.tpg-post-card:hover .tpg-post-image img {
    transform: scale(1.05);
}

/* --- Category Bubble / Badge --- */
.tpg-cat-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    z-index: 2;
    /* Background color managed by Elementor */
}

/* --- Post Content --- */
.tpg-post-content {
    padding: 20px; /* Default padding, can be controlled by Elementor */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tpg-post-title {
    margin: 0 0 10px 0;
    /* Typography managed by Elementor */
}

.tpg-post-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.tpg-post-excerpt {
    margin-bottom: 20px;
    flex-grow: 1;
    /* Color and Typography managed by Elementor */
}

/* --- Read More Button --- */
.tpg-read-more {
    display: inline-block;
    align-self: flex-start;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    transition: all 0.3s ease;
    /* Colors and Borders managed by Elementor */
}

/* --- Pagination Styling --- */
.tpg-pagination {
    margin-top: 40px; /* Overridden by Elementor */
    display: flex;
    justify-content: center;
    width: 100%;
    transition: opacity 0.3s ease;
}

.tpg-pagination ul.page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tpg-pagination ul.page-numbers li a,
.tpg-pagination ul.page-numbers li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd; /* Overridden by Elementor */
    border-radius: 4px; /* Overridden by Elementor */
    background: #fff; /* Overridden by Elementor */
    color: #333; /* Overridden by Elementor */
    transition: all 0.3s ease;
    font-weight: 500;
}

.tpg-pagination ul.page-numbers li a:hover {
    background: #f5f5f5; /* Overridden by Elementor */
}

/* Current Active Page */
.tpg-pagination ul.page-numbers li span.current {
    background: #0056b3; /* Overridden by Elementor */
    color: #fff; /* Overridden by Elementor */
    border-color: #0056b3; /* Overridden by Elementor */
}

/* --- Responsive Grid Adjustments --- */
/* Fallbacks in case Elementor variables are missing on lower breakpoints */
@media (max-width: 768px) {
    .tpg-post-grid {
        grid-template-columns: repeat(var(--tpg-cols, 2), 1fr);
    }
}

@media (max-width: 480px) {
    .tpg-post-grid {
        grid-template-columns: repeat(var(--tpg-cols, 1), 1fr);
    }
}