/* Besalp Gallery Widget Styles */
.besalp-gallery-container {
    width: 100%;
}

/* Filter buttons */
.besalp-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.besalp-gallery-filter-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.besalp-gallery-filter-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.besalp-gallery-filter-btn.active {
    background: #007cba;
    border-color: #007cba;
    color: #ffffff;
}

/* Gallery grid */
.besalp-gallery-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-flow: row;
    grid-auto-rows: min-content;
}

/* Gallery items */
.besalp-gallery-item {
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.besalp-gallery-item-image {
    position: relative;
    overflow: hidden;
}

.besalp-gallery-item-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* Aspect Ratio Controls */
.besalp-gallery-item-image[data-aspect-ratio="1:1"] {
    position: relative;
    padding-bottom: 100%; /* 1:1 Aspect Ratio */
}

.besalp-gallery-item-image[data-aspect-ratio="4:3"] {
    position: relative;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
}

.besalp-gallery-item-image[data-aspect-ratio="16:9"] {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
}

.besalp-gallery-item-image[data-aspect-ratio="3:2"] {
    position: relative;
    padding-bottom: 66.67%; /* 3:2 Aspect Ratio */
}

.besalp-gallery-item-image[data-aspect-ratio="1:1"] img,
.besalp-gallery-item-image[data-aspect-ratio="4:3"] img,
.besalp-gallery-item-image[data-aspect-ratio="16:9"] img,
.besalp-gallery-item-image[data-aspect-ratio="3:2"] img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Default, can be overridden by Elementor controls */
}

/* Object-fit specific styling adjustments */
.besalp-gallery-item-image img[style*="object-fit: contain"] {
    background-color: transparent;
}

.besalp-gallery-item-image img[style*="object-fit: fill"] {
    object-position: center;
}

.besalp-gallery-item-image img[style*="object-fit: scale-down"] {
    object-position: center;
}

.besalp-gallery-item-image img[style*="object-fit: none"] {
    object-position: center;
}

/* Handle padding when applied to images with aspect ratios */
.besalp-gallery-item-image[data-aspect-ratio]:not([data-aspect-ratio="auto"]) img[style*="padding"] {
    box-sizing: border-box;
}

.besalp-gallery-item-image a {
    display: block;
    text-decoration: none;
}

.besalp-gallery-item-content {
    padding: 20px;
}

.besalp-gallery-item-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
}

.besalp-gallery-item-title a {
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.besalp-gallery-item-title a:hover {
    color: #007cba;
}

.besalp-gallery-item-excerpt {
    color: #666666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* Hover animations */
.besalp-gallery-container[data-animation="scale"] .besalp-gallery-item:hover {
    transform: scale(1.05);
}

.besalp-gallery-container[data-animation="lift"] .besalp-gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.besalp-gallery-container[data-animation="zoom"] .besalp-gallery-item:hover .besalp-gallery-item-image img {
    transform: scale(1.1);
}

.besalp-gallery-container[data-animation="fade"] .besalp-gallery-item:hover {
    opacity: 0.8;
}

/* Filter animations */
.besalp-gallery-item {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.besalp-gallery-item.filter-animating {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.15s ease-out;
}

.besalp-gallery-item.filter-hidden {
    display: none !important;
}

.besalp-gallery-item.filter-show {
    opacity: 1;
    transform: scale(1);
    animation: fadeInScale 0.3s ease-out forwards;
}

/* Keyframe animation for smooth item appearance */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Grid columns are now handled by Elementor responsive controls */

/* Loading states */
.besalp-gallery-item.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* No results message */
.besalp-gallery-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* Accessibility improvements */
.besalp-gallery-filter-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.besalp-gallery-item-image a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.besalp-gallery-item-title a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
} 