/* Catalog Gallery Widget Styles */
.catalog-gallery-widget {
    position: relative;
    width: 100%;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Add scroll offset for fixed header */
.gallery-category {
    scroll-margin-top: 120px;
}

/* Category Filters */
.category-filters {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 20px 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    max-height: 80vh;
    overflow-y: auto;
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
    min-width: 140px;
}

.filter-btn {
    padding: 0;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    text-align: right;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-btn::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #ccc;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Maximum specificity override for Elementor conflicts */
.catalog-gallery-widget .category-filters .filter-list button.filter-btn,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn:hover,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn:focus,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn:active,
.catalog-gallery-widget .category-filters .filter-list button[type="button"].filter-btn,
.catalog-gallery-widget .category-filters .filter-list button[type="button"].filter-btn:hover,
.catalog-gallery-widget .category-filters .filter-list button[type="button"].filter-btn:focus {
    background-color: transparent !important;
    background: transparent !important;
    color: #888 !important;
    text-decoration: none !important;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
    text-align: right !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.catalog-gallery-widget .category-filters .filter-list button.filter-btn:hover,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn:focus {
    color: #333 !important;
}

.catalog-gallery-widget .category-filters .filter-list button.filter-btn.active,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn.active:hover,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn.active:focus {
    color: #007cba !important;
    font-weight: 500 !important;
}

/* Prevent any Elementor button reset */
.catalog-gallery-widget .category-filters .filter-list button.filter-btn * {
    box-sizing: border-box;
}

/* Ensure pseudo elements work */
.catalog-gallery-widget .category-filters .filter-list button.filter-btn::after {
    content: '' !important;
    width: 12px !important;
    height: 12px !important;
    border: 2px solid #ccc !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
    background: transparent !important;
}

.catalog-gallery-widget .category-filters .filter-list button.filter-btn:hover::after,
.catalog-gallery-widget .category-filters .filter-list button.filter-btn:focus::after {
    border-color: #007cba !important;
}

.catalog-gallery-widget .category-filters .filter-list button.filter-btn.active::after {
    border-color: #007cba !important;
    background: #007cba !important;
}

/* Gallery Category Section */
.gallery-category {
    margin-bottom: 50px;
    padding-right: 0;
}

.category-title {
    font-size: 32px;
    font-weight: bold;
    color: #007cba;
    margin: 0 0 30px 0;
    text-align: center;
    position: relative;
}

.category-title::after {
}

/* Gallery Grid */
.catalog-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Gallery Item */
.gallery-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Gallery Image */
.gallery-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    visibility: visible;
}

/* Gallery Actions */
.gallery-action {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.gallery-action:hover {
    background: #0055ca;
    color: #ffffff;
    transform: scale(1.1);
}

.download-btn:hover {
    background: #0055ca;
}

/* Gallery Title */
.gallery-title {
    padding: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.4;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fafafa;
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: 30px;
}

.load-more-btn {
    padding: 12px 30px;
    background: transparent;
    border: 2px solid #0055ca;
    color: #007cba;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.load-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.load-more-btn:hover {
    background: #007cba;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

.load-more-btn:hover::before {
    left: 100%;
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-btn.loading {
    pointer-events: none;
}

.load-more-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Lightbox Styles */
.catalog-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.catalog-gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 80vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    text-align: center;
    backdrop-filter: blur(10px);
    margin-top: -4px;
    width: 100%;
    max-width: 400px;
}

.lightbox-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.lightbox-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.lightbox-download-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Lightbox Navigation */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-category {
        padding-right: 180px;
    }
    
    .category-filters {
        right: 20px;
        padding: 15px 20px;
    }
    
    .filter-list {
        min-width: 120px;
        gap: 12px;
    }
    
    .filter-btn {
        font-size: 15px;
    }
    
    .catalog-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .category-title {
        font-size: 28px;
    }
    
    .gallery-image {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .gallery-category {
        padding-right: 0;
    }
    
    .category-filters {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-bottom: 30px;
        background: rgba(255, 255, 255, 0.98);
        border-radius: 15px;
        padding: 15px 20px;
        max-height: none;
        overflow-y: visible;
    }
    
    .filter-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
        gap: 15px 25px;
    }
    
    .filter-btn {
        font-size: 14px;
        text-align: center;
        width: auto;
        min-width: auto;
        justify-content: center;
    }
    
    .catalog-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .category-title {
        font-size: 24px;
    }
    
    .gallery-image {
        height: 160px;
    }
    
    .gallery-action {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .gallery-title {
        padding: 12px;
        font-size: 13px;
    }
    
    .lightbox-image {
        max-width: 95vw;
        max-height: 60vh;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .filter-btn {
        font-size: 13px;
        gap: 8px;
    }
    
    .filter-btn::after {
        width: 10px;
        height: 10px;
    }
    
    .catalog-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .gallery-image {
        height: 200px;
    }
    
    .load-more-btn {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .lightbox-info {
        padding: 15px;
    }
    
    .lightbox-title {
        font-size: 16px;
    }
    
    .lightbox-download-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Animation for new items */
.gallery-item.fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter animation */
.gallery-category.filtering {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.gallery-category.filtered-out {
    display: none;
}

/* Loading state */
.catalog-gallery-widget.loading {
    position: relative;
}

.catalog-gallery-widget.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-gallery-widget.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
    height: 100vh;
}