/**
 * @package     Joomla.Site
 * @subpackage  mod_custom_gallery
 *
 * @copyright   Copyright (C) 2023 Altamayuz Law Firm. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

.altamayuz-custom-gallery {
    margin-bottom: 30px;
}

.altamayuz-custom-gallery .gallery-title {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-size: 24px;
    color: #2c5282;
}

/* Grid Layout */
.altamayuz-custom-gallery .gallery-item-wrapper {
    margin-bottom: 25px;
}

.altamayuz-custom-gallery .gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: block;
    height: 0;
    padding-bottom: 66.67%; /* 2:3 aspect ratio */
    transition: all 0.3s ease;
    margin-bottom: 5px;
    border: none;
}

.altamayuz-custom-gallery .gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Add a subtle border */
.altamayuz-custom-gallery .gallery-item:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    pointer-events: none;
}

.altamayuz-custom-gallery .gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.altamayuz-custom-gallery .video-item {
    background-color: #1a1a1a;
}

.altamayuz-custom-gallery .video-item video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Use "contain" to see full video without cropping */
    background-color: #000;
}

/* Add a play button overlay for videos */
/* .altamayuz-custom-gallery .video-item:before {
    content: "\f04b"; /* Font Awesome play icon */
    /* font-family: "FontAwesome";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    z-index: 2;
    opacity: 0.8;
    pointer-events: none;
    width: 60px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
} */ 

.altamayuz-custom-gallery .item-title {
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 5px;
}

/* Masonry Layout */
.altamayuz-custom-gallery .masonry-container {
    column-count: 3;
    column-gap: 15px;
}

.altamayuz-custom-gallery .masonry-item {
    break-inside: avoid;
    margin-bottom: 15px;
}

/* Carousel Layout */
.altamayuz-custom-gallery .carousel {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.altamayuz-custom-gallery .carousel-item img {
    height: 50vh;
    object-fit: contain;
    background-color: #f5f5f5;
}

.altamayuz-custom-gallery .carousel-caption {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    padding: 10px;
    bottom: 20px;
}

.altamayuz-custom-gallery .video-container {
    height: 50vh;
    background-color: #000;
}

.altamayuz-custom-gallery .video-container video {
    height: 100%;
    width: 100%;
    object-fit: contain;
}

/* Tab Interface */
.altamayuz-custom-gallery .gallery-tabs {
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.altamayuz-custom-gallery .gallery-tabs .nav-link {
    font-weight: bold;
    color: #555;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px 20px;
    margin-right: 5px;
    transition: all 0.3s ease;
}

.altamayuz-custom-gallery .gallery-tabs .nav-link:hover {
    color: #2c5282;
    background: transparent;
    border-bottom-color: #ddd;
}

.altamayuz-custom-gallery .gallery-tabs .nav-link.active {
    color: #2c5282;
    background: transparent;
    border-bottom-color: #2c5282;
}

.altamayuz-custom-gallery .gallery-tab-content {
    padding-top: 15px;
}

/* RTL Support */
.altamayuz-custom-gallery[dir="rtl"] .gallery-tabs .nav-item {
    margin-right: 0;
    margin-left: 5px;
}

.altamayuz-custom-gallery[dir="rtl"] .gallery-tabs {
    padding-right: 0;
}

.altamayuz-custom-gallery[dir="rtl"] .item-title {
    direction: rtl;
    text-align: right;
}

.altamayuz-custom-gallery[dir="rtl"] .carousel-caption {
    direction: rtl;
    text-align: right;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .altamayuz-custom-gallery .masonry-container {
        column-count: 2;
    }
    
    .altamayuz-custom-gallery .gallery-tabs .nav-link {
        padding: 8px 15px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .altamayuz-custom-gallery .gallery-title {
        font-size: 20px;
    }
    
    .altamayuz-custom-gallery .carousel-item img,
    .altamayuz-custom-gallery .video-container {
        height: 40vh;
    }
    
    .altamayuz-custom-gallery .gallery-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .altamayuz-custom-gallery .gallery-tabs .nav-link {
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .altamayuz-custom-gallery .masonry-container {
        column-count: 1;
    }
    
    .altamayuz-custom-gallery .carousel-item img,
    .altamayuz-custom-gallery .video-container {
        height: 30vh;
    }
}
/* Lazy Loading Styles */
.gallery-item img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item img.loaded {
    opacity: 1;
}

.gallery-item .loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item .loading-placeholder.hidden {
    display: none;
}

/* WebP Support Detection */
.no-webp .webp-image {
    display: none;
}

.webp .fallback-image {
    display: none;
}