/**
 * Gallery Styles
 *
 * Styles for photo gallery including grid layout, image thumbnails,
 * lightbox styles, hover effects, and masonry layout support.
 *
 * @package Videohub360_Theme
 * @since 1.0.0
 */

/* ==========================================================================
   Gallery Grid Layout
   ========================================================================== */

/* Container for galleries */
.vh360-gallery-page .vh360-container,
.vh360-single-gallery .vh360-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.vh360-gallery-container {
    max-width: var(--max-width, 1200px);
    margin: 2rem auto;
    padding: 0 var(--spacing, 1rem);
}

.vh360-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
    width: 100%;
}

/* Auto-fill fallback for containers without explicit column count */
.vh360-gallery-container:not([class*="vh360-gallery-cols-"]) .vh360-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Masonry Layout Support */
.vh360-gallery-grid.masonry {
    display: block;
    column-count: 4;
    column-gap: 1rem;
}

.vh360-gallery-grid.masonry .vh360-gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
}

/* ==========================================================================
   Gallery Item / Image Thumbnail Styles
   ========================================================================== */

.vh360-gallery-item {
    position: relative;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-gallery-item:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.vh360-gallery-item-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.vh360-gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio by default */
    overflow: hidden;
    background: var(--bg-light);
}

.vh360-gallery-image-wrapper.landscape {
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
}

.vh360-gallery-image-wrapper.portrait {
    padding-bottom: 133.33%; /* 2:3 aspect ratio */
}

.vh360-gallery-image-wrapper.wide {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.vh360-gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.vh360-gallery-item:hover .vh360-gallery-image {
    transform: scale(1.05);
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

.vh360-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
}

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

.vh360-gallery-info {
    color: #ffffff;
}

.vh360-gallery-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: #ffffff;
}

.vh360-gallery-meta {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vh360-gallery-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   Gallery Actions
   ========================================================================== */

.vh360-gallery-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.vh360-gallery-item:hover .vh360-gallery-actions {
    opacity: 1;
}

.vh360-gallery-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-color);
}

.vh360-gallery-action-btn:hover {
    background: var(--surface-1);
    transform: scale(1.1);
}

.vh360-gallery-action-btn.delete {
    background: rgba(239, 68, 68, 0.95);
    color: #ffffff;
}

.vh360-gallery-action-btn.delete:hover {
    background: var(--error-color);
}

/* ==========================================================================
   Lightbox Preparation Styles
   ========================================================================== */

.vh360-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    animation: vh360-fadeIn 0.3s ease;
}

.vh360-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes vh360-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.vh360-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.vh360-lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.vh360-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.vh360-lightbox-nav.prev {
    left: 2rem;
}

.vh360-lightbox-nav.next {
    right: 2rem;
}

.vh360-lightbox-info {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    color: #ffffff;
    text-align: center;
}

/* ==========================================================================
   Gallery Upload Section
   ========================================================================== */

.vh360-gallery-upload {
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.vh360-gallery-upload:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.vh360-gallery-upload-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.vh360-gallery-upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-color);
}

.vh360-gallery-upload-text {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.vh360-gallery-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-gallery-upload-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.vh360-gallery-upload-input {
    display: none;
}

/* ==========================================================================
   Gallery Filters
   ========================================================================== */

.vh360-gallery-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.vh360-gallery-filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.vh360-gallery-filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-gallery-filter-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.vh360-gallery-filter-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.vh360-gallery-view-toggle {
    display: flex;
    gap: 0.5rem;
}

.vh360-gallery-view-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.vh360-gallery-view-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.vh360-gallery-view-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.vh360-gallery-loading {
    text-align: center;
    padding: 3rem;
}

.vh360-gallery-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: vh360-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes vh360-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Explicit column controls for gallery grids */
.vh360-gallery-cols-1 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: 1fr;
}

.vh360-gallery-cols-2 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: repeat(2, 1fr);
}

.vh360-gallery-cols-3 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: repeat(3, 1fr);
}

.vh360-gallery-cols-4 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: repeat(4, 1fr);
}

.vh360-gallery-cols-5 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: repeat(5, 1fr);
}

.vh360-gallery-cols-6 .vh360-gallery-grid:not(.masonry) {
    grid-template-columns: repeat(6, 1fr);
}

/* Masonry column control */
.vh360-gallery-cols-2 .vh360-gallery-grid.masonry {
    column-count: 2;
}

.vh360-gallery-cols-3 .vh360-gallery-grid.masonry {
    column-count: 3;
}

.vh360-gallery-cols-4 .vh360-gallery-grid.masonry {
    column-count: 4;
}

.vh360-gallery-cols-5 .vh360-gallery-grid.masonry {
    column-count: 5;
}

.vh360-gallery-cols-6 .vh360-gallery-grid.masonry {
    column-count: 6;
}

@media (max-width: 1200px) {
    .vh360-gallery-grid.masonry {
        column-count: 3;
    }
    
    .vh360-gallery-cols-5 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-6 .vh360-gallery-grid:not(.masonry) {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .vh360-gallery-cols-4 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-5 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-6 .vh360-gallery-grid:not(.masonry) {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .vh360-gallery-grid.masonry {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .vh360-gallery-container {
        padding: 0 1rem;
    }
    
    .vh360-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .vh360-gallery-cols-3 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-4 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-5 .vh360-gallery-grid:not(.masonry),
    .vh360-gallery-cols-6 .vh360-gallery-grid:not(.masonry) {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vh360-gallery-grid.masonry {
        column-count: 2;
        column-gap: 0.75rem;
    }
    
    .vh360-gallery-upload {
        padding: 2rem 1rem;
    }
    
    .vh360-lightbox-close,
    .vh360-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .vh360-lightbox-close {
        top: 1rem;
        right: 1rem;
    }
    
    .vh360-lightbox-nav.prev {
        left: 1rem;
    }
    
    .vh360-lightbox-nav.next {
        right: 1rem;
    }
    
    .vh360-lightbox-info {
        bottom: 1rem;
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .vh360-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .vh360-gallery-grid.masonry {
        column-count: 1;
    }
    
    .vh360-gallery-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .vh360-gallery-filter-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .vh360-gallery-view-toggle {
        justify-content: center;
    }
}

/* ==========================================================================
   PhotoSwipe Integration & Fixes
   ========================================================================== */

/* Ensure PhotoSwipe has correct z-index */
.pswp {
    z-index: 999999;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Hide PhotoSwipe completely when closed - CRITICAL for preventing image artifacts */
.pswp[aria-hidden="true"] {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    display: none;
}

/* Ensure pswp items don't show when closed */
.pswp[aria-hidden="true"] .pswp__item,
.pswp[aria-hidden="true"] .pswp__img,
.pswp[aria-hidden="true"] .pswp__zoom-wrap {
    visibility: hidden;
    opacity: 0;
    display: none;
}

.pswp__bg {
    background-color: rgba(0, 0, 0, 0.95);
}

/* Ensure close button is clickable - increase z-index and hit area */
.pswp__button--close {
    z-index: 9999999;
    cursor: pointer;
    position: relative;
}

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

/* Reset PhotoSwipe item containers when closing - prevent images floating around */
.pswp--close .pswp__item,
.pswp--destroy .pswp__item,
.pswp--close .pswp__img,
.pswp--destroy .pswp__img {
    visibility: hidden;
    opacity: 0;
    transform: none;
}

/* When body doesn't have pswp-open, ensure all pswp content is hidden */
body:not(.pswp-open) .pswp,
body:not(.pswp-open) .pswp__item,
body:not(.pswp-open) .pswp__img {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Ensure gallery items stay in their containers and don't leak */
.vh360-single-gallery {
    position: relative;
    z-index: 1;
}

.vh360-single-gallery-content {
    position: relative;
    z-index: 1;
    overflow: visible;
}

.vh360-gallery-container {
    position: relative;
    z-index: 1;
}

/* Reset gallery items - force them to stay in place */
.vh360-gallery-item {
    position: relative;
    z-index: 1;
    will-change: auto;
}

/* CRITICAL: When pswp is closed, ensure gallery items have no transform */
body:not(.pswp-open) .vh360-gallery-item {
    transform: none;
}

/* Ensure footer stays in place and above any lingering lightbox artifacts */
.site-footer,
footer,
#footer {
    position: relative;
    z-index: 10;
}

/* Ensure proper stacking during hover animations only */
.vh360-gallery-item:hover {
    z-index: 2;
}

/* ==========================================================================
   Single Gallery Template Styles
   ========================================================================== */

.vh360-single-gallery {
    padding-bottom: 3rem;
    background: var(--surface-1);
}

.vh360-single-gallery-header {
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--surface-3) 0%, var(--surface-1) 100%);
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-1);
}

.vh360-gallery-breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.vh360-gallery-breadcrumb a {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

.vh360-gallery-breadcrumb a:hover {
    color: var(--primary-color, #2563eb);
}

.vh360-breadcrumb-sep {
    margin: 0 0.75rem;
    color: var(--border-1);
}

.vh360-breadcrumb-current {
    color: var(--text-1);
    font-weight: 500;
}

.vh360-single-gallery-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: var(--text-1);
    line-height: 1.2;
}

.vh360-single-gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem 0;
}

.vh360-gallery-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vh360-gallery-author img {
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.vh360-gallery-author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.vh360-gallery-author-name {
    font-weight: 600;
    color: var(--text-1);
    font-size: 1rem;
}

.vh360-gallery-date {
    font-size: 0.875rem;
    color: var(--text-2);
}

.vh360-gallery-stats {
    display: flex;
    gap: 1.5rem;
}

.vh360-gallery-image-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-2);
    font-size: 0.9375rem;
    padding: 0.5rem 1rem;
    background: var(--surface-1);
    border-radius: 0.5rem;
    border: 1px solid var(--border-1);
}

.vh360-single-gallery-excerpt {
    margin-top: 1.5rem;
    font-size: 1.125rem;
    color: var(--text-2);
    line-height: 1.7;
    max-width: 65ch;
}

.vh360-single-gallery-content {
    padding: 0 0 2rem;
}

/* Enhanced Gallery Grid in Single View */
.vh360-single-gallery-content .vh360-gallery-container {
    margin: 0;
    padding: 0;
    max-width: 100%;
}

.vh360-single-gallery-content .vh360-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 0;
    width: 100%;
}

.vh360-single-gallery-content .vh360-gallery-item {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: none;
    background: var(--surface-1);
    width: 100%;
}

.vh360-single-gallery-content .vh360-gallery-item:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-6px);
}

.vh360-single-gallery-content .vh360-gallery-image-wrapper {
    padding-bottom: 75%;
    background: linear-gradient(135deg, var(--surface-3) 0%, var(--border-1) 100%);
    position: relative;
    width: 100%;
}

.vh360-single-gallery-content .vh360-gallery-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
}

.vh360-gallery-zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    color: var(--text-1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.vh360-gallery-item:hover .vh360-gallery-zoom-icon {
    opacity: 1;
}

.vh360-gallery-caption {
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-2);
    background: var(--surface-1);
    border-top: 1px solid var(--border-1);
}

.vh360-gallery-no-images {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-2);
    background: var(--surface-3);
    border-radius: 1rem;
    border: 2px dashed var(--border-1);
}

.vh360-gallery-no-images svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.vh360-gallery-no-images p {
    font-size: 1.125rem;
    margin: 0;
}

.vh360-single-gallery-description {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-1);
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-1);
}

.vh360-single-gallery-footer {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-1);
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.vh360-gallery-categories,
.vh360-gallery-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.vh360-gallery-categories strong,
.vh360-gallery-tags strong {
    color: var(--text-1);
    font-size: 0.875rem;
}

.vh360-gallery-term {
    display: inline-block;
    padding: 0.375rem 1rem;
    background: var(--surface-3);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--text-color, #374151);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.vh360-gallery-term:hover {
    background: var(--primary-color, #2563eb);
    color: #fff;
    border-color: var(--primary-color, #2563eb);
}

.vh360-single-gallery-comments {
    margin-top: 3rem;
    padding: 2.5rem 0;
    background: var(--surface-3);
    border-top: 1px solid var(--border-1);
}

/* Related Galleries Section */
.vh360-related-galleries {
    margin-top: 3rem;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--surface-3) 0%, var(--surface-1) 100%);
    border-top: 1px solid var(--border-1);
}

.vh360-related-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 2rem;
    color: var(--text-1);
}

.vh360-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.vh360-gallery-card {
    background: var(--surface-1);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.vh360-gallery-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.vh360-gallery-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.vh360-gallery-card-cover {
    position: relative;
    padding-bottom: 66.67%;
    background: linear-gradient(135deg, var(--surface-3) 0%, var(--border-1) 100%);
    overflow: hidden;
}

.vh360-gallery-card-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.vh360-gallery-card:hover .vh360-gallery-card-cover img {
    transform: scale(1.05);
}

.vh360-gallery-card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light, #9ca3af);
}

.vh360-gallery-card-count {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    border-radius: 2rem;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
}

.vh360-gallery-card-info {
    padding: 1.25rem;
}

.vh360-gallery-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-1);
    line-height: 1.4;
}

/* Simple Fallback Lightbox Styles */
.vh360-simple-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
}

.vh360-simple-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vh360-simple-lightbox-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
}

.vh360-simple-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vh360-simple-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.vh360-simple-lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.vh360-simple-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.vh360-simple-lightbox-prev,
.vh360-simple-lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vh360-simple-lightbox-prev {
    left: 1.5rem;
}

.vh360-simple-lightbox-next {
    right: 1.5rem;
}

.vh360-simple-lightbox-prev:hover,
.vh360-simple-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.vh360-simple-lightbox-caption {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.9375rem;
    max-width: 600px;
    text-align: center;
}

/* ==========================================================================
   Custom Gallery Lightbox Styles (VH360 Gallery Lightbox)
   ========================================================================== */

.vh360-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.vh360-gallery-lightbox.vh360-gallery-lightbox-open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s ease;
}

.vh360-gallery-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.vh360-gallery-lightbox-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vh360-gallery-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vh360-gallery-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.vh360-gallery-lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.vh360-gallery-lightbox-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vh360-lightbox-spin 0.8s linear infinite;
}

@keyframes vh360-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

.vh360-gallery-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.vh360-gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.vh360-gallery-lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.vh360-gallery-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.vh360-gallery-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.vh360-gallery-lightbox-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.vh360-gallery-lightbox-prev {
    left: 20px;
}

.vh360-gallery-lightbox-next {
    right: 20px;
}

.vh360-gallery-lightbox-footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 100;
}

.vh360-gallery-lightbox-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
}

.vh360-gallery-lightbox-caption {
    color: #fff;
    font-size: 14px;
    max-width: 600px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
}

/* Body class when lightbox is open */
body.vh360-lightbox-open {
    overflow: hidden;
}

/* Responsive lightbox styles */
@media (max-width: 768px) {
    .vh360-gallery-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .vh360-gallery-lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .vh360-gallery-lightbox-prev {
        left: 10px;
    }
    
    .vh360-gallery-lightbox-next {
        right: 10px;
    }
    
    .vh360-gallery-lightbox-content {
        max-width: 95vw;
    }
}

/* ==========================================================================
   Single Gallery Responsive Styles
   ========================================================================== */

@media (max-width: 992px) {
    .vh360-single-gallery-title {
        font-size: 2rem;
    }
    
    .vh360-single-gallery-content .vh360-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.25rem;
    }
    
    .vh360-related-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .vh360-single-gallery-header {
        padding: 2rem 0;
    }
    
    .vh360-single-gallery-title {
        font-size: 1.75rem;
    }

    .vh360-single-gallery-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .vh360-single-gallery-content .vh360-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .vh360-related-galleries {
        padding: 2rem 0;
    }

    .vh360-related-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .vh360-single-gallery-footer {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .vh360-single-gallery-header {
        padding: 1.5rem 0;
    }
    
    .vh360-single-gallery-title {
        font-size: 1.5rem;
    }
    
    .vh360-single-gallery-content .vh360-gallery-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .vh360-gallery-zoom-icon {
        width: 44px;
        height: 44px;
    }
    
    .vh360-related-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .vh360-gallery-card-info {
        padding: 1rem;
    }
    
    .vh360-gallery-card-title {
        font-size: 0.9375rem;
    }
}

/* ==========================================================================
   Gallery Archive Styles
   ========================================================================== */

.vh360-gallery-archive {
    padding: 2rem 0;
}

.vh360-gallery-archive-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-1);
}

.vh360-gallery-archive-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: var(--text-1);
}

.vh360-gallery-archive-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.vh360-gallery-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.vh360-gallery-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-2);
    margin-top: 0.25rem;
}

.vh360-gallery-pagination {
    text-align: center;
    margin-top: 2rem;
}

.vh360-gallery-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 0.5rem;
}

.vh360-gallery-pagination li {
    margin: 0;
}

.vh360-gallery-pagination a,
.vh360-gallery-pagination span {
    display: block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-1);
    border-radius: var(--border-radius, 0.5rem);
    text-decoration: none;
    color: var(--text-1);
    transition: var(--transition, all 0.2s ease);
}

.vh360-gallery-pagination a:hover {
    background: var(--surface-3);
    border-color: var(--primary-color, #2563eb);
    color: var(--primary-color, #2563eb);
}

.vh360-gallery-pagination .current {
    background: var(--primary-color, #2563eb);
    border-color: var(--primary-color, #2563eb);
    color: #fff;
}

.vh360-gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-2);
}

.vh360-gallery-empty-icon {
    margin-bottom: 1.5rem;
}

.vh360-gallery-empty h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: var(--text-1);
}

.vh360-gallery-empty p {
    margin: 0;
}

/* Archive Responsive Styles */
@media (max-width: 768px) {
    .vh360-gallery-archive-title {
        font-size: 1.5rem;
    }

    .vh360-gallery-archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .vh360-gallery-archive-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
}
