/**
 * ArtPress Gallery Public Styles
 *
 * @package ArtPress_Gallery
 * @since 1.0.0
 */

/* Multiple Galleries Container - Now displays as one continuous gallery */
.artpress-galleries-container {
    margin: 20px;
    padding: 20px;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.artpress-galleries-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Gallery Container - NO SPACING */
.artpress-gallery-container {
    margin: 20px;
    padding: 20px;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Responsive Design - Maintain symmetric margins in all viewports */
@media (max-width: 768px) {
    .artpress-galleries-container {
        margin: 15px;
        padding: 15px;
        width: calc(100% - 30px);
        max-width: calc(100% - 30px);
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .artpress-galleries-container {
        margin: 10px;
        padding: 10px;
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        border-radius: 8px;
    }
}

/* Gallery Grid - Improved Layout */

/* Gallery Grid - Improved Layout with Responsive Support */
.artpress-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    grid-auto-flow: dense;
    align-items: start;
}

/* Responsive Grid Adjustments */
@media (max-width: 1024px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 5px;
    }
}

/* Ensure no empty spaces by using dense packing */
.artpress-gallery-grid:not(.masonry-layout) {
    grid-auto-flow: dense;
}

/* Alternative: Masonry-style layout for better space utilization */
.artpress-gallery-grid.masonry-layout {
    columns: 4;
    column-gap: 0;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin: 0;
    padding: 0;
}

.artpress-gallery-grid.masonry-layout.loaded {
    opacity: 1;
}

.artpress-gallery-grid.masonry-layout .artpress-gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    display: block;
    page-break-inside: avoid;
    width: 100%;
    position: relative;
}

/* Carousel/Slider Layout */
.artpress-gallery-grid.carousel-layout {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    gap: 0;
    padding: 0;
    margin: 0;
    position: relative;
}

.artpress-gallery-grid.carousel-layout::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.artpress-gallery-grid.carousel-layout .artpress-gallery-item {
    flex: 0 0 auto;
    width: 300px;
    min-width: 300px;
    margin: 0;
    padding: 0;
    transition: transform 0.3s ease;
    position: relative;
}

.artpress-gallery-grid.carousel-layout .artpress-gallery-item:hover {
    transform: scale(1.05);
}

/* Carousel Navigation */
.artpress-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.artpress-carousel-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.artpress-carousel-nav.prev {
    left: 10px;
}

.artpress-carousel-nav.next {
    right: 10px;
}

/* Carousel Indicators */
.artpress-carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.artpress-carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.artpress-carousel-indicator.active {
    background: #667eea;
    transform: scale(1.2);
}

/* Auto-scroll animation */
@keyframes carousel-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.artpress-gallery-grid.carousel-layout.auto-scroll {
    animation: carousel-scroll 30s linear infinite;
}

.artpress-gallery-grid.carousel-layout.auto-scroll:hover {
    animation-play-state: paused;
}

/* Responsive masonry columns */
@media (max-width: 1200px) {
    .artpress-gallery-grid.masonry-layout {
        columns: 3;
    }
}

@media (max-width: 768px) {
    .artpress-gallery-grid.masonry-layout {
        columns: 2;
    }
}

@media (max-width: 480px) {
    .artpress-gallery-grid.masonry-layout {
        columns: 1;
    }
}



/* Gallery Item - Enhanced with working overlay */
.artpress-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f8f9fa;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.artpress-gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Images and Videos */
.artpress-gallery-item img,
.artpress-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.artpress-gallery-item:hover img,
.artpress-gallery-item:hover video {
    transform: scale(1.1);
}

/* WORKING BLACK OVERLAY - This will definitely work */
.artpress-gallery-item .thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
    transition: all 0.3s ease;
    pointer-events: none;
}

.artpress-gallery-item:hover .thumbnail-overlay {
    background: rgba(0, 0, 0, 0);
    opacity: 0;
}

/* Gallery Links */
.artpress-gallery-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

/* Images and Videos */
.artpress-gallery-item img,
.artpress-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.artpress-gallery-item:hover img,
.artpress-gallery-item:hover video {
    transform: scale(1.1);
}

/* Video Play Icon */
.artpress-gallery-item .video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5em;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.artpress-gallery-item:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Gallery Overlay */
.artpress-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 3;
}

.artpress-gallery-item:hover .artpress-gallery-overlay {
    transform: translateY(0);
}

.artpress-gallery-overlay h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.3;
}

.artpress-gallery-overlay p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.4;
}

/* Loading States */
.artpress-gallery-loading {
    position: relative;
    min-height: 200px;
}

.artpress-gallery-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: artpress-spin 1s linear infinite;
}

@keyframes artpress-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Access Denied Messages */
.artpress-gallery-access-denied {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    margin: 20px 0;
}

.artpress-gallery-access-denied h3 {
    color: #6c757d;
    margin: 0 0 15px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.artpress-gallery-access-denied p {
    color: #868e96;
    margin: 0;
    font-size: 1em;
    line-height: 1.6;
}

.artpress-gallery-access-denied .artpress-login-button {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.artpress-gallery-access-denied .artpress-login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Empty State */
.artpress-gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.artpress-gallery-empty::before {
    content: '🖼️';
    font-size: 3em;
    display: block;
    margin-bottom: 20px;
}

.artpress-gallery-empty h3 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    font-weight: 600;
}

.artpress-gallery-empty p {
    margin: 0;
    font-size: 1em;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }
    
    .artpress-gallery-item {
        border-radius: 8px;
    }
    
    .artpress-gallery-item:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .artpress-gallery-item .video-play-icon {
        width: 60px;
        height: 60px;
        font-size: 2em;
    }
    
    .artpress-gallery-overlay {
        padding: 15px;
    }
    
    .artpress-gallery-overlay h3 {
        font-size: 1em;
    }
    
    .artpress-gallery-overlay p {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .artpress-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
        padding: 10px 0;
    }
    
    .artpress-gallery-item {
        border-radius: 6px;
    }
    
    .artpress-gallery-item .video-play-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
    
    .artpress-gallery-overlay {
        padding: 12px;
    }
    
    .artpress-gallery-overlay h3 {
        font-size: 0.9em;
        margin-bottom: 6px;
    }
    
    .artpress-gallery-overlay p {
        font-size: 0.8em;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .artpress-gallery-item img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .artpress-gallery-item,
    .artpress-gallery-item img,
    .artpress-gallery-item video,
    .artpress-gallery-item .video-play-icon,
    .artpress-gallery-overlay {
        transition: none;
    }
    
    .artpress-gallery-item:hover {
        transform: none;
    }
    
    .artpress-gallery-item:hover img,
    .artpress-gallery-item:hover video {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .artpress-gallery-item {
        background: #2d3748;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .artpress-gallery-item:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    }
    
    .artpress-gallery-access-denied {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #4a5568;
    }
    
    .artpress-gallery-access-denied h3 {
        color: #e2e8f0;
    }
    
    .artpress-gallery-access-denied p {
        color: #a0aec0;
    }
    
    .artpress-gallery-empty {
        color: #a0aec0;
    }
}

/* Focus States for Accessibility */
.artpress-gallery-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.artpress-gallery-link:focus .artpress-gallery-item {
    transform: translateY(-4px) scale(1.02);
}

/* Print Styles */
@media print {
    .artpress-gallery-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .artpress-gallery-item:hover {
        transform: none;
    }
    
    .artpress-gallery-overlay {
        transform: translateY(0);
        background: rgba(0, 0, 0, 0.9);
    }
}


