/* ============================================
   Before/After Gallery Styles 
   ============================================ */

/* Gallery Wrapper */
.ba-gallery-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 8rem auto;
    padding: 6rem 3em;
}

/* Gallery Grid */
.ba-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 15px;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

body.lightbox-open .ba-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
}

/* Gallery Tiles */
.ba-gallery-tile {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: #f5f5f5;
}

.ba-gallery-tile:hover {
    box-shadow: none;
}

.ba-gallery-tile .share {
    margin: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: #fff;
    z-index: 1;
    padding: 1.2rem 2rem;
}

.ba-gallery-tile:hover .share {
    opacity: 1;
}

/* Gallery Tile Hover Overlay */
.ba-gallery-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.ba-gallery-tile:hover::before {
    opacity: 1;
}

/* Plus Icon on Hover */
.ba-gallery-tile::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 94px;
    height: 94px;
    background-image: url("data:image/svg+xml,%3Csvg width='94' height='94' viewBox='0 0 94 94' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='47' cy='47' r='41.5' stroke='white' stroke-opacity='0.5' stroke-width='11'/%3E%3Cpath d='M51.7938 64H45.1471V27.4427H51.7938V64Z' fill='white'/%3E%3Cpath d='M30.1918 49.0449L30.1918 42.3981L66.7491 42.3982L66.7491 49.0449L30.1918 49.0449Z' fill='white'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.ba-gallery-tile:hover::after {
    opacity: 1;
}

/* Gallery Images */
.ba-gallery-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.ba-gallery-tile:hover .ba-gallery-image {
    
}

/* Before/After Badge */
.ba-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #c41e3a;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.4);
    z-index: 2;
}

/* ============================================
   Lightbox Styles
   ============================================ */

/* Lightbox Overlay */
.ba-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Lightbox Container */
.ba-lightbox-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    transform: scale(1);
    transition: none;
    max-width: none; /* Remove max-width constraint */
}

.ba-lightbox-overlay.active .ba-lightbox-container {
    transform: scale(1); 
}

/* Close Button */
.ba-lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background: #CB2835;
    border: none;
    border-radius: 0;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: none;
    padding: 0;
}

.ba-lightbox-close:hover {
    box-shadow: none;
}


.ba-lightbox-close::before,
.ba-lightbox-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #fff;
    transition: background 0.2s ease;
}

.ba-lightbox-close::before {
    transform: rotate(45deg);
}

.ba-lightbox-close::after {
    transform: rotate(-45deg);
}

/* Main Image Area */
.ba-lightbox-main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    padding: 0;
}

.ba-lightbox-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ba-lightbox-image.loaded {
    opacity: 1;
}

/* Navigation Arrows */
.ba-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    width: 130px;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: none;
      background: linear-gradient(
    to right,
    rgb(0 0 0 / 60%) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

.ba-lightbox-nav.next {background: linear-gradient(to left, rgb(0 0 0 / 60%) 0%, rgba(0, 0, 0, 0) 100%);}

.ba-lightbox-nav:hover {
    box-shadow: none;
}

.ba-lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ba-lightbox-nav:disabled:hover {
    transform: translateY(-50%);
}

.ba-lightbox-nav.prev {
    left: 0;
}

.ba-lightbox-nav.next {
    right: 0;
}

.ba-lightbox-nav::after {
    content: '';
    width: 50px;
    height: 88px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 51 89'%3E%3Cpath d='M48.4264 87.2428C46.0834 89.5858 42.2842 89.5856 39.941 87.2428L1.75745 49.0582C-0.585701 46.7151 -0.585701 42.917 1.75745 40.5739L39.941 2.38928C42.2842 0.0464554 46.0834 0.0462418 48.4264 2.38928C50.7694 4.73232 50.7692 8.53146 48.4264 10.8746L14.485 44.816L48.4264 78.7574C50.7692 81.1006 50.7694 84.8998 48.4264 87.2428Z' fill='white' fill-opacity='0.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.ba-lightbox-nav.prev::after {
}

.ba-lightbox-nav.next::after {
    transform: rotate(
180deg);
}

/* Before/After Toggle Button */
.ba-lightbox-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    column-gap: 25px;
    flex-wrap: nowrap;
    max-width: 100%;
    width: 100%;
    z-index: 5;
}

.ba-lightbox-footer .share {
    background: #fff;
    padding: 2rem;
    margin: 0;
}

/* Before/After Toggle Button */
.ba-toggle-btn {
    text-transform: uppercase;
    padding: 1rem;
    text-decoration: none;
    font-size: 1.3rem;
    line-height: 1.5rem;
    letter-spacing: 0.1rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-width: 27rem;
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    border-radius: 0;
    transition: background-position 0.5s;
    background-color: #cc092f;
    border: 0.3rem solid #cc092f;
    color: #fff;
    box-shadow: none;
    outline: none;
    margin: 0 0rem 6rem 5rem;
}

.ba-toggle-btn:hover {
    box-shadow: none;
    border-color: #cc092f;
}

.ba-toggle-btn.hidden {
    display: none;
}

.ba-toggle-btn::after {
    transition: all 0.5s;
    content: '';
    background-repeat: no-repeat;
    background-size: 1.8rem 3.6rem;
    width: 1.8rem;
    height: 3.6rem;
    right: 0;
    display: inline-block;
    padding-left: 0;
    vertical-align: middle;
    background-image: url("../images/arrow-white.png")
}

.ba-toggle-btn:hover::after {
    right: -8px;
}

/* Share Button */
.ba-share-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border-radius: 2px;
}

.ba-share-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Thumbnail Strip */
.ba-lightbox-thumbs {
    background: black;
    /* padding: 10px; */
    border-top: 1px solid #333;
    display: flex;
    gap: 5px;
    /* overflow-x: auto; */
    scroll-behavior: smooth;
    position: relative;
    flex-shrink: 0; 
    height: 100px;
}

.ba-lightbox-thumbs::-webkit-scrollbar {
    height: 8px;
}

.ba-lightbox-thumbs::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ba-lightbox-thumbs::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ba-lightbox-thumbs::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.ba-lightbox-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    border: 3px solid transparent;
}

.ba-lightbox-thumb:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.ba-lightbox-thumb.active {
    opacity: 1;
    border-color: #c41e3a;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .ba-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .ba-gallery-tile::after {
        width: 75px;
        height: 75px;
    }

    .ba-lightbox-image  {
        object-fit: scale-down;
    }

    .ba-gallery-tile {
        aspect-ratio: 1/1;
    }

    .ba-gallery-tile .share {
        display: none;
    }

    .ba-badge {
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        font-size: 10px;
    }

    .ba-lightbox-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .ba-lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .ba-lightbox-nav.prev {
        left: 10px;
    }

    .ba-lightbox-nav.next {
        right: 10px;
    }

    .ba-lightbox-footer .share .share__label {
        display: block;
    }

    .ba-lightbox-footer .share {
        padding: 1rem 1rem;
    }

    .ba-toggle-btn {
        bottom: 0;
        left: 0;
        padding: 10px 20px;
        font-size: 11px;
        margin: 0;
    }

    .ba-share-btn {
        display: none;
    }

    .ba-lightbox-thumb {
        width: 80px;
        height: 60px;
    }

    .ba-lightbox-thumbs {
        height: 80px;
        padding: 5px;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .ba-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .ba-gallery-tile {
        aspect-ratio: 4/3;
    }
}