/* Grid-specific styles using Flexbox for better alignment control */
.podify-events-layout-grid .podify-events-flex-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: var(--podify-gap, 30px);
    grid-template-columns: none !important;
    justify-content: flex-start;
}

/* Calculate width based on columns and gap */
.podify-events-layout-grid .podify-event-card {
    display: flex;
    flex-direction: column;
    /* Formula: (100% - (columns - 1) * gap) / columns */
    width: calc( (100% - (var(--podify-columns, 4) - 1) * var(--podify-gap, 30px)) / var(--podify-columns, 4) );
    margin: 0 !important; /* Ensure no external margins interfere */
    flex-shrink: 0;
    height: 100%; /* Ensure equal height */
}

/* Alignment support */
.podify-align-center .podify-events-flex-grid,
.podify-align-center .podify-events-swiper .swiper-wrapper,
.podify-align-tablet-center .podify-events-flex-grid,
.podify-align-tablet-center .podify-events-swiper .swiper-wrapper,
.podify-align-mobile-center .podify-events-flex-grid,
.podify-align-mobile-center .podify-events-swiper .swiper-wrapper {
    justify-content: center !important;
}

.podify-align-right .podify-events-flex-grid,
.podify-align-right .podify-events-swiper .swiper-wrapper,
.podify-align-tablet-right .podify-events-flex-grid,
.podify-align-tablet-right .podify-events-swiper .swiper-wrapper,
.podify-align-mobile-right .podify-events-flex-grid,
.podify-align-mobile-right .podify-events-swiper .swiper-wrapper {
    justify-content: flex-end !important;
}

.podify-align-left .podify-events-flex-grid,
.podify-align-left .podify-events-swiper .swiper-wrapper,
.podify-align-tablet-left .podify-events-flex-grid,
.podify-align-tablet-left .podify-events-swiper .swiper-wrapper,
.podify-align-mobile-left .podify-events-flex-grid,
.podify-align-mobile-left .podify-events-swiper .swiper-wrapper {
    justify-content: flex-start !important;
}

/* Ensure images fit nicely */
.podify-events-layout-grid .event-image {
    border-radius: 0;
    width: 100%;
    height: 277px;
    flex-shrink: 0;
}

.podify-events-layout-grid .event-image img {
    border-radius: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
