/* WP Photo & Video Gallery Styles */

.wpvg-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Tab Navigation */
.wpvg-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: white;
}

.wpvg-tab {
    flex: 1;
    max-width: 200px;
    background: #f8f9fa;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wpvg-tab:first-child {
    border-radius: 8px 0 0 8px;
}

.wpvg-tab:last-child {
    border-radius: 0 8px 8px 0;
}

.wpvg-tab.active {
    background: #28a745;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.wpvg-tab:hover:not(.active) {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Tab Content */
.wpvg-tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.wpvg-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Gallery Grid - Updated to match backend design */
.wpvg-galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

/* Gallery Card - Updated to match backend */
.wpvg-gallery-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.wpvg-gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.wpvg-gallery-header {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

/* Gallery Preview - Fixed to match backend exactly */
.wpvg-gallery-preview {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 100%;
    gap: 2px;
    overflow: hidden;
}

.wpvg-preview-item {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

/* First image takes up left side completely */
.wpvg-preview-item:first-child {
    grid-column: 1;
    grid-row: 1 / -1;
}

/* Second image - top right */
.wpvg-preview-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

/* Third image - bottom right */
.wpvg-preview-item:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

/* If only one image, it should fill the entire space */
.wpvg-preview-item:only-child {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

/* If only two images */
.wpvg-gallery-preview:has(.wpvg-preview-item:nth-child(2):last-child) .wpvg-preview-item:first-child {
    grid-column: 1;
    grid-row: 1 / -1;
}

.wpvg-gallery-preview:has(.wpvg-preview-item:nth-child(2):last-child) .wpvg-preview-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / -1;
}

.wpvg-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wpvg-preview-item:hover img {
    transform: scale(1.1);
}

.wpvg-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wpvg-preview-item:hover .wpvg-preview-overlay {
    opacity: 1;
}

.wpvg-item-count {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.wpvg-gallery-info {
    padding: 25px;
    background: white;
}

.wpvg-gallery-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.wpvg-gallery-description {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.wpvg-gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.wpvg-item-count-text {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.wpvg-gallery-date {
    font-size: 12px;
    color: #999;
}

/* Empty Gallery Preview */
.wpvg-empty-preview {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
}

.wpvg-empty-preview svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

.wpvg-empty-preview p {
    margin: 5px 0 0 0;
    font-size: 14px;
}

/* Single Gallery View */
.wpvg-single-gallery {
    margin: 30px 0;
}

.wpvg-gallery-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.wpvg-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.wpvg-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.wpvg-item-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.wpvg-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wpvg-item:hover .wpvg-item-image img {
    transform: scale(1.05);
}

.wpvg-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wpvg-item:hover .wpvg-item-overlay {
    opacity: 1;
}

.wpvg-play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
}

.wpvg-play-icon:hover {
    background: white;
    transform: scale(1.1);
}

.wpvg-zoom-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s ease;
}

.wpvg-zoom-icon:hover {
    background: white;
    transform: scale(1.1);
}

.wpvg-item-title {
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: center;
    background: white;
}

/* Video specific styles */
.wpvg-video-item .wpvg-item-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
}

.wpvg-video-item:hover .wpvg-item-overlay {
    background: rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wpvg-galleries-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .wpvg-container {
        padding: 15px;
    }
    
    .wpvg-tabs {
        flex-direction: column;
        margin-bottom: 30px;
    }
    
    .wpvg-tab {
        border-radius: 0 !important;
        max-width: none;
    }
    
    .wpvg-tab:first-child {
        border-radius: 8px 8px 0 0 !important;
    }
    
    .wpvg-tab:last-child {
        border-radius: 0 0 8px 8px !important;
    }
    
    .wpvg-galleries-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .wpvg-gallery-items {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .wpvg-gallery-header {
        height: 250px;
    }
    
    .wpvg-item-image {
        height: 200px;
    }
    
    .wpvg-gallery-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .wpvg-gallery-preview {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    
    .wpvg-preview-item:first-child {
        grid-row: 1;
        grid-column: 1;
        height: 100%;
    }
    
    .wpvg-preview-item:not(:first-child) {
        display: none;
    }
    
    .wpvg-gallery-info {
        padding: 20px;
    }
    
    .wpvg-item-title {
        padding: 15px;
        font-size: 14px;
    }
    
    .wpvg-gallery-header {
        height: 200px;
    }
}

/* Loading Animation */
.wpvg-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 18px;
    color: #666;
}

.wpvg-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No galleries message */
.wpvg-no-galleries {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
}

.wpvg-no-galleries::before {
    content: '📷';
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
}

/* Magnific Popup Customizations */
.mfp-bg {
    background: rgba(0, 0, 0, 0.9);
}

.mfp-close-btn-in .mfp-close {
    color: white;
    font-size: 44px;
    line-height: 44px;
    right: -6px;
    text-align: center;
    top: 0;
}

.mfp-arrow {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
}

.mfp-arrow:after {
    border-top-width: 13px;
    border-bottom-width: 13px;
    margin-left: -6px;
    top: 18px;
}

.mfp-arrow-left:after {
    border-right: 17px solid white;
    margin-left: -5px;
}

.mfp-arrow-right:after {
    border-left: 17px solid white;
    margin-left: -12px;
}