/**
 * ATS Featured Posts - Styles
 */

/* Container */
.ats-featured-container {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.ats-featured-container * {
    box-sizing: border-box;
}

/* Grid Layout */
.ats-featured-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 200px; /* Prevent collapse */
}

/* Row Layout */
.ats-featured-row {
    display: flex;
    width: 100%;
    min-height: 200px; /* Ensure rows have minimum height */
}

.ats-featured-row[data-posts="1"] .ats-featured-item {
    width: 100%;
}

.ats-featured-row[data-posts="2"] .ats-featured-item {
    width: calc(50% - 7.5px);
}

.ats-featured-row[data-posts="3"] .ats-featured-item {
    width: calc(33.333% - 10px);
}

.ats-featured-row[data-posts="4"] .ats-featured-item {
    width: calc(25% - 11.25px);
}

.ats-featured-row[data-posts="5"] .ats-featured-item {
    width: calc(20% - 12px);
}

.ats-featured-row[data-posts="6"] .ats-featured-item {
    width: calc(16.666% - 12.5px);
}

/* Featured Item */
.ats-featured-item {
    position: relative;
    overflow: hidden;
    display: block;
    text-decoration: none;
    flex-shrink: 0;
    background-color: #1a1a1a;
    min-height: 200px; /* Default minimum height to prevent collapse */
}

/* Support for percentage-based height */
.ats-featured-item::before {
    content: '';
    display: block;
    padding-top: 0;
}

.ats-featured-item img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
}

/* No Image Placeholder */
.ats-featured-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2a2a2a;
    color: #666;
    font-size: 14px;
}

/* Overlay for hover effects */
.ats-featured-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    pointer-events: none;
    z-index: 1;
}

/* Content Container */
.ats-featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
}

/* Title */
.ats-featured-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    margin: 0 0 5px 0;
    padding: 0;
}

/* Brand */
.ats-featured-brand {
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    line-height: 1.4;
    opacity: 0.9;
}

/* ===========================================
   HOVER EFFECTS
   =========================================== */

/* Zoom Effect */
[data-hover-effect="zoom"] .ats-featured-item img {
    transform: scale(1);
}

[data-hover-effect="zoom"] .ats-featured-item:hover img {
    transform: scale(1.1);
}

/* Zoom Out Effect */
[data-hover-effect="zoom-out"] .ats-featured-item img {
    transform: scale(1.1);
}

[data-hover-effect="zoom-out"] .ats-featured-item:hover img {
    transform: scale(1);
}

/* Brightness Effect */
[data-hover-effect="brightness"] .ats-featured-item img {
    filter: brightness(1);
}

[data-hover-effect="brightness"] .ats-featured-item:hover img {
    filter: brightness(1.2);
}

/* Grayscale Effect */
[data-hover-effect="grayscale"] .ats-featured-item img {
    filter: grayscale(0);
}

[data-hover-effect="grayscale"] .ats-featured-item:hover img {
    filter: grayscale(100%);
}

/* Blur Effect */
[data-hover-effect="blur"] .ats-featured-item:hover img {
    filter: blur(3px);
}

/* Overlay Darken Effect */
[data-hover-effect="overlay"] .ats-featured-item .ats-featured-overlay {
    background-color: rgba(0, 0, 0, 0);
}

[data-hover-effect="overlay"] .ats-featured-item:hover .ats-featured-overlay {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Slide Up Effect */
[data-hover-effect="slide-up"] .ats-featured-item .ats-featured-content {
    transform: translateY(20px);
    opacity: 0.7;
}

[data-hover-effect="slide-up"] .ats-featured-item:hover .ats-featured-content {
    transform: translateY(0);
    opacity: 1;
}

/* ===========================================
   BUTTON STYLES
   =========================================== */

.ats-featured-button-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ats-featured-button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.ats-featured-button:hover {
    text-decoration: none;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

/* Tablet */
@media screen and (max-width: 1024px) {
    .ats-featured-title {
        font-size: 16px;
    }

    .ats-featured-brand {
        font-size: 11px;
    }
}

/* Mobile */
@media screen and (max-width: 767px) {
    .ats-featured-grid {
        height: auto !important;
        min-height: 200px;
    }

    .ats-featured-row {
        flex-direction: column;
        height: auto !important; /* Don't rely on parent height percentage */
        min-height: auto; /* Allow content to determine height */
    }

    .ats-featured-row .ats-featured-item {
        width: 100% !important;
        margin-bottom: 10px;
        /* Ensure items have visible height even if responsive settings fail */
        min-height: 200px !important;
    }

    .ats-featured-row .ats-featured-item:last-child {
        margin-bottom: 0;
    }

    /* Ensure images maintain proper sizing on mobile */
    .ats-featured-item img {
        min-height: 200px !important;
    }

    .ats-featured-title {
        font-size: 14px;
    }

    .ats-featured-brand {
        font-size: 10px;
    }

    .ats-featured-button {
        width: 100%;
    }
}

/* Fix for Elementor editor */
.elementor-editor-active .ats-featured-item img {
    max-width: none !important;
    max-height: none !important;
}
