/* Miftah Gallery Widget Styles - Alma-style coverflow slider */

.miftah-gallery-section {
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #0f2e5c;
    padding: 60px 40px;
    box-sizing: border-box;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Title */
.miftah-gallery-title {
    color: #ffffff;
    font-size: 38px;
    font-weight: 600;
    margin: 0 0 50px 0;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Slider Outer - Full width for coverflow */
.miftah-gallery-slider-outer {
    position: relative;
    width: 100%;
    height: 500px; /* Default height, overridden by Elementor control */
    margin: 0 auto 40px auto;
}

.miftah-gallery-slider-outer .swiper {
    width: 100%;
    height: 100%;
    overflow: visible !important;
    position: relative;
}

.miftah-gallery-slider-outer .swiper-wrapper {
    align-items: center;
}

/* Slide Image (background-image approach like Alma) */
.miftah-gallery-slide-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Centered Slides Effect */
.miftah-gallery-slider-outer .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease;
    opacity: 1;
    position: relative;
    height: 100%;
    /* Default width, overridden by Elementor control */
    width: 60%;
}

.miftah-gallery-slider-outer .swiper-slide:not(.swiper-slide-active) {
    z-index: 1;
}

.miftah-gallery-slider-outer .swiper-slide-active {
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Overlay for side slides */
.miftah-gallery-slider-outer .swiper-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    transition: all 0.5s ease;
    pointer-events: none;
    z-index: 3;
}

/* Active slide has no overlay */
.miftah-gallery-slider-outer .swiper-slide-active::after {
    background-color: transparent !important;
}

/* Navigation Arrows */
.miftah-gallery-slider-outer .swiper-button-next,
.miftah-gallery-slider-outer .swiper-button-prev {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: auto;
}

.miftah-gallery-slider-outer .swiper-button-next:hover,
.miftah-gallery-slider-outer .swiper-button-prev:hover {
    background-color: rgba(255, 255, 255, 0.45);
}

.miftah-gallery-slider-outer .swiper-button-next::after,
.miftah-gallery-slider-outer .swiper-button-prev::after {
    font-size: 20px;
    font-weight: bold;
}

/* Position arrows at edges of active slide */
.miftah-gallery-slider-outer .swiper-button-prev {
    left: calc((100% - var(--center-slide-width, 60%)) / 2);
    right: auto;
}

.miftah-gallery-slider-outer .swiper-button-next {
    right: calc((100% - var(--center-slide-width, 60%)) / 2);
    left: auto;
}

/* RTL Specific Overrides for proper arrow positioning */
[dir="rtl"] .miftah-gallery-slider-outer .swiper-button-prev {
    left: calc((100% - var(--center-slide-width, 60%)) / 2) !important;
    right: auto !important;
}

[dir="rtl"] .miftah-gallery-slider-outer .swiper-button-next {
    right: calc((100% - var(--center-slide-width, 60%)) / 2) !important;
    left: auto !important;
}

/* Rotate Swiper arrow icons in RTL because they are physically placed on correct sides */
[dir="rtl"] .miftah-gallery-slider-outer .swiper-button-prev::after,
[dir="rtl"] .miftah-gallery-slider-outer .swiper-button-next::after {
    transform: rotate(180deg) !important;
}

/* Brochure Outlined Button */
.miftah-gallery-btn-wrapper {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.miftah-gallery-brochure-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 34px;
    border: 2px solid #ffffff;
    background-color: transparent;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-sizing: border-box;
}

.miftah-gallery-brochure-btn:hover {
    background-color: #ffffff;
    color: #0f2e5c;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .miftah-gallery-section {
        padding: 40px 20px;
    }

    .miftah-gallery-title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .miftah-gallery-slider-outer {
        height: 350px;
    }

    .miftah-gallery-slider-outer .swiper-slide {
        width: 85% !important;
    }

    .miftah-gallery-slider-outer .swiper-button-prev {
        left: calc((100% - 85%) / 2) !important;
        width: 40px;
        height: 40px;
    }

    .miftah-gallery-slider-outer .swiper-button-next {
        right: calc((100% - 85%) / 2) !important;
        width: 40px;
        height: 40px;
    }

    .miftah-gallery-slider-outer .swiper-button-next::after,
    .miftah-gallery-slider-outer .swiper-button-prev::after {
        font-size: 16px;
    }

    .miftah-gallery-brochure-btn {
        padding: 12px 24px;
        font-size: 13px;
    }
}

/* Custom Lightbox Overlay */
.miftah-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 46, 92, 0.97); /* Deep Navy Tint */
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(8px);
}

.miftah-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.miftah-lightbox-close {
    position: absolute !important;
    top: 25px !important;
    right: 30px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: #ffffff !important;
    font-size: 42px !important;
    cursor: pointer !important;
    line-height: 1 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    transition: color 0.3s ease, transform 0.3s ease !important;
    z-index: 1000001 !important;
}

.miftah-lightbox-close:hover {
    color: #c9a96e !important; /* Miftah Gold */
    transform: rotate(90deg) !important;
}

.miftah-lightbox-prev,
.miftah-lightbox-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    font-size: 30px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: all 0.3s ease !important;
    z-index: 1000001 !important;
    user-select: none !important;
}

.miftah-lightbox-prev:hover,
.miftah-lightbox-next:hover {
    background-color: #c9a96e !important;
    border-color: #c9a96e !important;
    color: #0f2e5c !important;
}

.miftah-lightbox-prev {
    left: 40px !important;
}

.miftah-lightbox-next {
    right: 40px !important;
}

.miftah-lightbox-content {
    max-width: 80%;
    max-height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.miftah-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.miftah-lightbox-overlay.active .miftah-lightbox-image {
    transform: scale(1);
}

/* Lightbox active slide pointer */
.miftah-gallery-tab-section[data-lightbox-enabled="yes"] .swiper-slide-active {
    cursor: zoom-in;
}

@media (max-width: 768px) {
    .miftah-lightbox-prev {
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    .miftah-lightbox-next {
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    .miftah-lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 36px;
    }
    .miftah-lightbox-content {
        max-width: 90%;
    }
}
