/* Tabbed Gallery Widget Styles */

.tgw-tabbed-gallery-widget {
    width: 100%;
    background: transparent;
}

/* Tabs Container */
.tgw-tabs-container {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.tgw-tabs-wrapper {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

/* Individual Tab Button */
.tgw-tab {
    flex-shrink: 0;
    padding: 15px 40px;
    border: 2px solid #D4A047;
    border-radius: 50px;
    background-color: transparent;
    color: #D4A047;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    outline: none;
    text-transform: capitalize;
}

.tgw-tab:hover {
    opacity: 0.8;
}

.tgw-tab.active {
    background-color: #D4A047;
    color: #ffffff;
    border-color: #D4A047;
}

/* Gallery Content */
.tgw-gallery-content {
    margin-top: 30px;
    position: relative;
}

.tgw-gallery-panel {
    display: none;
}

.tgw-gallery-panel.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

/* Gallery Grid */
.tgw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.tgw-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.tgw-gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.tgw-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.tgw-gallery-item:hover img {
    transform: scale(1.05);
}

/* Image Ratios */
.tgw-ratio-1-1 .tgw-gallery-item {
    aspect-ratio: 1 / 1;
}

.tgw-ratio-4-3 .tgw-gallery-item {
    aspect-ratio: 4 / 3;
}

.tgw-ratio-16-9 .tgw-gallery-item {
    aspect-ratio: 16 / 9;
}

.tgw-ratio-3-4 .tgw-gallery-item {
    aspect-ratio: 3 / 4;
}

.tgw-ratio-auto .tgw-gallery-item {
    aspect-ratio: auto;
}

.tgw-ratio-auto .tgw-gallery-item img {
    height: auto;
}

/* No Images Message */
.tgw-no-images {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .tgw-tabs-container {
        overflow-x: auto;
        overflow-y: hidden;
        /* Hide scrollbar for Chrome, Safari and Opera */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    .tgw-tabs-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }
    
    .tgw-tabs-wrapper {
        display: flex;
        flex-wrap: nowrap;
        width: max-content;
        padding-right: 20px; /* Add some padding at the end */
    }
    
    .tgw-tab {
        padding: 12px 30px;
        font-size: 14px;
    }
    
    /* Gallery adjustments for mobile */
    .tgw-gallery-content {
        margin-top: 20px;
    }
    
    .tgw-gallery-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1024px) {
    .tgw-tabs-container {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tgw-tabs-container::-webkit-scrollbar {
        display: none;
    }
    
    .tgw-tabs-wrapper {
        width: max-content;
    }
    
    .tgw-tab {
        padding: 14px 35px;
        font-size: 15px;
    }
    
    .tgw-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Desktop - No scroll, normal flex wrap if needed */
@media (min-width: 1025px) {
    .tgw-tabs-container {
        overflow: visible;
    }
    
    .tgw-tabs-wrapper {
        flex-wrap: wrap;
    }
}

/* Smooth scrolling for touch devices */
.tgw-tabs-container {
    scroll-behavior: smooth;
}

/* Optional: Fade effect at edges to indicate more tabs */
@media (max-width: 1024px) {
    .tgw-tabs-container::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .tgw-tabs-container.has-more-tabs::after {
        opacity: 1;
    }
}

/* Accessibility */
.tgw-tab:focus {
    outline: 2px solid #D4A047;
    outline-offset: 2px;
}

.tgw-tab:focus:not(:focus-visible) {
    outline: none;
}

/* Loading state (optional) */
.tgw-gallery-panel.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* RTL Support */
[dir="rtl"] .tgw-tabs-wrapper {
    direction: rtl;
}

[dir="rtl"] .tgw-tabs-container::after {
    right: auto;
    left: 0;
    background: linear-gradient(to left, transparent, rgba(255, 255, 255, 0.9));
}
