/**
 * AMICO Events Listing Widget Styles
 */

.amico-events-listing-widget {
    width: 100%;
}

/* Filter Pills */
.amico-events-listing-widget .filter-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0; /* Spacing controlled by pills_margin_bottom Elementor control on .filter-pills */
    position: relative;
    overflow: visible;
}

.amico-events-listing-widget .filter-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
}

/* Ensure parent containers don't clip the pills and keep scroll behavior consistent */
@media (max-width: 1024px) {

    /* Override all possible parent container clipping */
    .elementor-widget-amico-events-listing,
    .elementor-widget-container,
    .amico-events-listing-widget,
    .amico-news-events-wrapper {
        overflow: visible !important;
    }

    /* Allow horizontal scrolling similar to the tabbed archive widget */
    .amico-events-listing-widget .filter-pills {
        position: relative !important;
        z-index: 10 !important;
        width: calc(100% + 40px);
        margin-left: -20px;
        margin-right: -20px;
        padding: 0 20px;
    }
}

/* Pill visual styles moved to shared rules in assets/css/news-events-style.css */

/* Events Grid */
.events-listing-container {
    position: relative;
}

.events-listing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    animation: fadeIn 0.5s ease;
}

/* Event Card */
.event-listing-card {
    background: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.event-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Event Image */
.event-listing-image {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.event-listing-card:hover .event-listing-image img {
    transform: scale(1.05);
}

/* Date Badge */
.event-date-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0;
    padding: 8px 12px;
    text-align: center;
    min-width: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.event-date-badge .day {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: #000000;
}

.event-date-badge .month-year {
    display: block;
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Event Content */
.event-listing-content {
    padding: 24px;
}

.event-listing-title {
    font-size: 18px;
    font-weight: 600;
    color: #18191A;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-listing-meta {
    font-size: 13px;
    color: #666666;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-listing-meta .separator {
    color: #CCCCCC;
}

.event-listing-description {
    font-size: 14px;
    line-height: 1.6;
    color: #333333;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* No Events Message */
.no-events-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666666;
    font-size: 16px;
}

/* Loading State */
.events-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .events-listing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Match tabbed widget behavior: 16px gutters + horizontal scroll */
    .amico-events-listing-widget .filter-pills {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        /* margin-bottom controlled by pills_margin_bottom Elementor control */
        padding: 0 !important;
        box-sizing: border-box !important;

        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: none;
        /* IE/Edge */
        scrollbar-width: none;
        /* Firefox */

        /* Ensure it's not clipped */
        position: relative !important;
        z-index: 10 !important;
    }

    /* Add internal spacing using pseudo-elements */
    .amico-events-listing-widget .filter-pills::before,
    .amico-events-listing-widget .filter-pills::after {
        content: '';
        flex: 0 0 16px;
        height: 1px;
    }

    .amico-events-listing-widget .filter-pills::-webkit-scrollbar {
        display: none;
    }

    .amico-events-listing-widget .filter-pill {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .events-listing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .event-listing-image {
        height: 200px;
    }

    .event-listing-content {
        padding: 16px;
    }

    .event-listing-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .events-listing-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .amico-events-listing-widget .event-card-grid {
        gap: 16px;
    }

}