/**
 * EBP Events Grid Widget Styles
 */

/* Container */
.ebp-events-wrapper {
    position: relative;
    width: 100%;
}

/* Grid Layout */
.ebp-events-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Event Item */
.ebp-event-item {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Hover Animations */
.ebp-events-grid[data-hover="float"] .ebp-event-item:hover {
    transform: translateY(-10px);
}

.ebp-events-grid[data-hover="scale"] .ebp-event-item:hover {
    transform: scale(1.03);
}

.ebp-events-grid[data-hover="shadow"] .ebp-event-item:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Event Content */
.ebp-event-content {
    display: flex;
    flex-direction: column;
}

/* Event Image */
.ebp-event-image {
    position: relative;
    overflow: hidden;
    width: 100%;
}

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

.ebp-event-item:hover .ebp-event-image img {
    transform: scale(1.05);
}

/* Event Title */
.ebp-event-title {
    margin: 0 0 10px 0;
    font-size: 1.25em;
    line-height: 1.3;
}

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

/* Event Description */
.ebp-event-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Date & Time */
.ebp-event-date,
.ebp-event-time,
.ebp-event-datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.ebp-event-date i,
.ebp-event-time i,
.ebp-event-datetime i {
    font-size: 1em;
}

.ebp-time-prefix {
    font-weight: 400;
    opacity: 0.8;
}

/* Price */
.ebp-event-price {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
}

.ebp-price-prefix {
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0.8;
}

.ebp-price-suffix {
    font-weight: 400;
    font-size: 0.85em;
    opacity: 0.8;
}

/* RTL Price Display */
.ebp-event-price.ebp-price-rtl {
    direction: rtl;
    unicode-bidi: bidi-override;
}

.ebp-event-price.ebp-price-rtl .ebp-price-amount {
    direction: ltr;
    unicode-bidi: embed;
}

/* Availability */
.ebp-event-availability {
    margin-bottom: 15px;
}

.ebp-availability-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ebp-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.ebp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ebp-availability-text {
    font-size: 0.85em;
    color: #666;
}

/* Button */
.ebp-event-button {
    display: inline-block;
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.ebp-event-button:hover {
    background: #135e96;
    color: #fff;
}

/* Field Labels */
.ebp-field-label {
    font-weight: 500;
    opacity: 0.7;
}

/* Divider */
.ebp-event-divider {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 15px 0;
}

/* ACF & Meta Fields */
.ebp-event-acf-field,
.ebp-event-meta-field {
    margin-bottom: 10px;
    font-size: 0.9em;
}

/* ==========================================
 * Carousel Styles
 * ========================================== */

.ebp-events-carousel {
    position: relative;
    overflow: hidden;
}

.ebp-events-carousel .swiper-wrapper {
    display: flex;
}

.ebp-events-carousel .swiper-slide {
    height: auto;
}

.ebp-events-carousel .ebp-event-item {
    height: 100%;
}

/* Partial View */
.ebp-events-carousel.partial-view {
    overflow: visible;
    padding: 0 50px;
}

/* Navigation Arrows */
.ebp-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.ebp-carousel-nav:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.ebp-carousel-prev {
    left: 10px;
}

.ebp-carousel-next {
    right: 10px;
}

.ebp-carousel-nav.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Pagination Dots */
.ebp-events-carousel .swiper-pagination {
    position: relative;
    margin-top: 20px;
    text-align: center;
}

.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #ccc;
    opacity: 1;
    margin: 0 5px;
}

.swiper-pagination-bullet-active {
    background: #2271b1;
}

/* ==========================================
 * Pagination Styles
 * ========================================== */

.ebp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 30px;
}

.ebp-pagination a,
.ebp-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.ebp-pagination a:hover {
    background: #e0e0e0;
}

.ebp-pagination .current {
    background: #2271b1;
    color: #fff;
}

/* Load More Button */
.ebp-load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.ebp-load-more {
    padding: 15px 40px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ebp-load-more:hover {
    background: #135e96;
}

.ebp-load-more:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Infinite Scroll */
.ebp-infinite-scroll-trigger {
    height: 1px;
    margin-top: 20px;
}

.ebp-loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
}

.ebp-loading-indicator::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ebp-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes ebp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Events Message */
.ebp-no-events-message {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

/* ==========================================
 * Equal Height Items
 * ========================================== */

.ebp-even-height .ebp-events-grid {
    align-items: stretch;
}

.ebp-even-height .ebp-events-grid .ebp-event-item {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ebp-even-height .ebp-events-grid .ebp-event-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ebp-even-height .ebp-events-grid .ebp-event-button {
    margin-top: auto;
}

/* Carousel already has equal height via swiper-slide height:auto */
.ebp-even-height .ebp-events-carousel .ebp-event-item {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ebp-even-height .ebp-events-carousel .ebp-event-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ebp-even-height .ebp-events-carousel .ebp-event-button {
    margin-top: auto;
}

/* ==========================================
 * Mobile Carousel Toggle
 * ========================================== */

/* Default: hide mobile-only elements */
.ebp-show-on-mobile {
    display: none !important;
}

/* Default: show desktop elements */
.ebp-hide-on-mobile {
    display: grid;
}

/* ==========================================
 * Responsive Styles
 * ========================================== */

@media (max-width: 1024px) {
    .ebp-events-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large phones (iPhone Pro Max, Samsung Galaxy Ultra, etc.) - keep mobile layout
   These devices have screen widths up to ~430px in portrait, ~930px in landscape
   Using 480px ensures all large phones in portrait get mobile layout */
@media (max-width: 480px) {
    .ebp-events-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Mobile carousel toggle for large phones */
    .ebp-carousel-on-mobile .ebp-show-on-mobile {
        display: block !important;
    }

    .ebp-carousel-on-mobile .ebp-hide-on-mobile {
        display: none !important;
    }

    .ebp-carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .ebp-carousel-prev {
        left: 5px;
    }

    .ebp-carousel-next {
        right: 5px;
    }

    .ebp-events-carousel.partial-view {
        padding: 0 20px;
    }

    .ebp-event-button {
        width: 100%;
        padding: 14px 20px;
    }
}

/* Standard tablets and smaller devices */
@media (max-width: 767px) {
    .ebp-events-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile carousel toggle */
    .ebp-carousel-on-mobile .ebp-show-on-mobile {
        display: block !important;
    }

    .ebp-carousel-on-mobile .ebp-hide-on-mobile {
        display: none !important;
    }

    .ebp-carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .ebp-carousel-prev {
        left: 5px;
    }

    .ebp-carousel-next {
        right: 5px;
    }

    .ebp-events-carousel.partial-view {
        padding: 0 30px;
    }
}

/* ==========================================
   Category Filter Styles
   ========================================== */
.ebp-category-filter {
    margin-bottom: 25px;
}

/* Dropdown Style */
.ebp-filter-dropdown .ebp-filter-select {
    min-width: 200px;
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ebp-filter-dropdown .ebp-filter-select:hover {
    border-color: #999;
}

.ebp-filter-dropdown .ebp-filter-select:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

/* Buttons Style */
.ebp-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ebp-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ebp-filter-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.ebp-filter-btn.active {
    color: #fff;
    background: #4a90d9;
    border-color: #4a90d9;
}

.ebp-filter-btn .ebp-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 11px;
}

.ebp-filter-btn.active .ebp-filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Tabs Style */
.ebp-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid #eee;
}

.ebp-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ebp-filter-tab:hover {
    color: #333;
}

.ebp-filter-tab.active {
    color: #4a90d9;
    border-bottom-color: #4a90d9;
}

.ebp-filter-tab .ebp-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    background: #f0f0f0;
    border-radius: 12px;
}

.ebp-filter-tab.active .ebp-filter-count {
    color: #fff;
    background: #4a90d9;
}

/* Filtering State */
.ebp-events-wrapper.ebp-filtering .ebp-events-grid,
.ebp-events-wrapper.ebp-filtering .ebp-events-carousel {
    pointer-events: none;
}

.ebp-events-wrapper .ebp-events-grid,
.ebp-events-wrapper .ebp-events-carousel {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Price Tier Styles */
.ebp-price-range {
    display: inline-flex;
    align-items: center;
}

.ebp-price-separator {
    color: #888;
    margin: 0 2px;
}

.ebp-price-tiers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ebp-price-tier-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ebp-tier-name {
    color: #666;
    font-size: 0.9em;
}

/* Date List Styles */
.ebp-dates-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ebp-date-item {
    line-height: 1.4;
}

.ebp-dates-more {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
}

.ebp-date-count {
    color: #4a90d9;
    font-weight: 500;
}

/* No Events Message */
.ebp-no-events-message {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    grid-column: 1 / -1;
}

/* Mobile Responsive for Filter */
@media (max-width: 768px) {
    .ebp-filter-dropdown .ebp-filter-select {
        width: 100%;
    }

    .ebp-filter-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .ebp-filter-btn {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 13px;
    }

    .ebp-filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .ebp-filter-tab {
        flex-shrink: 0;
        padding: 10px 15px;
        font-size: 13px;
    }
}
