/* ==========================================================================
   CARDEL GALLERY COMPONENTS - GLOBAL STYLES
   ========================================================================== */

/* ==========================================================================
   CARDEL SWIPER GALLERY - Main Gallery with Navigation & Lightbox
   ========================================================================== */

/* Fractional Slides Support - FIXED */
.cardel-swiper-gallery-wrapper .swiper-slide {
    width: auto !important;
    flex-shrink: 0;
}

.cardel-swiper-gallery-wrapper .swiper-wrapper {
    display: flex;
}

/* WHOLE NUMBER SLIDES FIX - Ensure exact slide counts */
.cardel-swiper-gallery-wrapper[data-slides="1"] .swiper-slide {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.cardel-swiper-gallery-wrapper[data-slides="2"] .swiper-slide {
    width: calc(50% - 5px) !important;
    max-width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
}

.cardel-swiper-gallery-wrapper[data-slides="3"] .swiper-slide {
    width: calc(33.333% - 7px) !important;
    max-width: calc(33.333% - 7px) !important;
    flex: 0 0 calc(33.333% - 7px) !important;
}

.cardel-swiper-gallery-wrapper[data-slides="4"] .swiper-slide {
    width: calc(25% - 8px) !important;
    max-width: calc(25% - 8px) !important;
    flex: 0 0 calc(25% - 8px) !important;
}

/* Fractional slides - only apply when specifically requested */
.cardel-swiper-gallery-wrapper[data-slides="1.5"] .swiper-slide {
    width: 66.666% !important;
    max-width: 66.666% !important;
    flex: 0 0 66.666% !important;
}

.cardel-swiper-gallery-wrapper[data-slides="2.5"] .swiper-slide {
    width: 40% !important;
    max-width: 40% !important;
    flex: 0 0 40% !important;
}

/* Container Styling */
.cardel-swiper-gallery-wrapper {
    margin: 20px 0;
    position: relative;
}

.cardel-swiper-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* Slide Styling */
.cardel-swiper-gallery-wrapper .swiper-slide {
    position: relative;
    cursor: pointer;
}

.cardel-slide-image-container {
    width: 100%;
    height: auto;
    position: relative;
}

.cardel-slide-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* Navigation Buttons */
.cardel-swiper-gallery-wrapper .swiper-button-next,
.cardel-swiper-gallery-wrapper .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    transition: all 0.3s ease;
}

.cardel-swiper-gallery-wrapper .swiper-button-next:hover,
.cardel-swiper-gallery-wrapper .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.cardel-swiper-gallery-wrapper .swiper-button-next::after,
.cardel-swiper-gallery-wrapper .swiper-button-prev::after {
    font-size: 18px;
    font-weight: bold;
}

/* Pagination */
.cardel-swiper-gallery-wrapper .swiper-pagination {
    bottom: 15px;
}

.cardel-swiper-gallery-wrapper .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
}

.cardel-swiper-gallery-wrapper .swiper-pagination-bullet-active {
    background: #fff;
    transform: scale(1.2);
}

/* ==========================================================================
   CARDEL SIMPLE GALLERY - Auto-playing Background Gallery
   ========================================================================== */

.cardel-simple-gallery {
    margin: 20px 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.cardel-simple-gallery .swiper {
    width: 100%;
    height: 100%;
}

.cardel-simple-gallery .swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cardel-simple-gallery .swiper-slide img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Simple Gallery - No Navigation (Clean Look) */
.cardel-simple-gallery .swiper-button-next,
.cardel-simple-gallery .swiper-button-prev {
    display: none;
}

.cardel-simple-gallery .swiper-pagination {
    display: none;
}

/* ==========================================================================
   CARDEL STANDARD GALLERY - Basic Multi-slide Gallery
   ========================================================================== */

.cardel-gallery {
    margin: 20px 0;
    position: relative;
}

.cardel-gallery .swiper-slide img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.cardel-gallery .swiper-button-next,
.cardel-gallery .swiper-button-prev {
    color: #333;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    transition: all 0.3s ease;
}

.cardel-gallery .swiper-button-next:hover,
.cardel-gallery .swiper-button-prev:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.cardel-gallery .swiper-pagination-bullet {
    background: #333;
    opacity: 0.5;
}

.cardel-gallery .swiper-pagination-bullet-active {
    opacity: 1;
}

/* ==========================================================================
   COMMUNITY-SPECIFIC OVERRIDES
   ========================================================================== */

/* Deer Creek Community Styling */
.deer-creek-gallery .swiper-button-next,
.deer-creek-gallery .swiper-button-prev {
    color: #608585;
    background: rgba(255, 255, 255, 0.8);
}

.deer-creek-gallery .swiper-button-next:hover,
.deer-creek-gallery .swiper-button-prev:hover {
    color: #B51B1B;
    background: rgba(255, 255, 255, 0.9);
}

.deer-creek-gallery .swiper-pagination-bullet {
    background: #608585;
}

.deer-creek-gallery .swiper-pagination-bullet-active {
    background: #B51B1B;
}

/* Three Hills Community Styling */
.three-hills-gallery .swiper-button-next,
.three-hills-gallery .swiper-button-prev {
    color: #c47e5a;
    background: rgba(255, 255, 255, 0.8);
}

.three-hills-gallery .swiper-button-next:hover,
.three-hills-gallery .swiper-button-prev:hover {
    color: #0d5257;
    background: rgba(255, 255, 255, 0.9);
}

.three-hills-gallery .swiper-pagination-bullet {
    background: #c47e5a;
}

.three-hills-gallery .swiper-pagination-bullet-active {
    background: #0d5257;
}

/* ==========================================================================
   LIGHTBOX STYLING
   ========================================================================== */

.cardel-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cardel-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cardel-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.cardel-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cardel-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}

.cardel-lightbox-close:hover {
    opacity: 0.7;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 991px) {
    .cardel-swiper-gallery-wrapper .swiper-button-next,
    .cardel-swiper-gallery-wrapper .swiper-button-prev,
    .cardel-gallery .swiper-button-next,
    .cardel-gallery .swiper-button-prev {
        width: 35px;
        height: 35px;
        margin-top: -17px;
    }
    
    .cardel-swiper-gallery-wrapper .swiper-button-next::after,
    .cardel-swiper-gallery-wrapper .swiper-button-prev::after {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .cardel-swiper-gallery-wrapper,
    .cardel-simple-gallery,
    .cardel-gallery {
        margin: 15px 0;
    }
    
    .cardel-swiper-gallery-wrapper .swiper-button-next,
    .cardel-swiper-gallery-wrapper .swiper-button-prev,
    .cardel-gallery .swiper-button-next,
    .cardel-gallery .swiper-button-prev {
        width: 30px;
        height: 30px;
        margin-top: -15px;
    }
    
    .cardel-lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    /* Mobile responsive overrides for whole number slides */
    .cardel-swiper-gallery-wrapper[data-slides="2"] .swiper-slide,
    .cardel-swiper-gallery-wrapper[data-slides="3"] .swiper-slide,
    .cardel-swiper-gallery-wrapper[data-slides="4"] .swiper-slide {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

@media (max-width: 480px) {
    /* Hide navigation on very small screens for cleaner look */
    .cardel-swiper-gallery-wrapper .swiper-button-next,
    .cardel-swiper-gallery-wrapper .swiper-button-prev {
        display: none;
    }
    
    .cardel-swiper-gallery-wrapper .swiper-pagination {
        display: block;
    }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.cardel-gallery-loading {
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
}

.cardel-gallery-error {
    padding: 20px;
    text-align: center;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .cardel-swiper-gallery-wrapper .swiper-button-next,
    .cardel-swiper-gallery-wrapper .swiper-button-prev,
    .cardel-gallery .swiper-button-next,
    .cardel-gallery .swiper-button-prev,
    .cardel-swiper-gallery-wrapper .swiper-pagination,
    .cardel-gallery .swiper-pagination {
        display: none !important;
    }
}