/**
 * PixelVault - Frontend Gallery Styles
 */

.pixelvault-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #1e293b;
}

/* Category Filter */
.pv-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.pv-category-btn {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pv-category-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    text-decoration: none;
}

.pv-category-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* Image Gallery Grid */
.pv-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.pv-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Image Zoom on Hover */
.pv-gallery-item {
    overflow: hidden;
}

.pv-gallery-link {
    display: block;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.pv-gallery-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.3s ease;
    transform-origin: center center;
    will-change: transform;
}

/* Zoom effect on gallery item hover */
.pv-gallery-item:hover .pv-gallery-image,
.pv-gallery-link:hover .pv-gallery-image {
    transform: scale(1.15);
    filter: brightness(1.08);
}

/* Disable zoom for masonry layout to prevent layout issues */
.pv-image-gallery.layout-masonry .pv-gallery-item:hover .pv-gallery-image,
.pv-image-gallery.layout-masonry .pv-gallery-link:hover .pv-gallery-image {
    transform: scale(1.05);
}

.pv-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 20px 15px 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

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

.pv-gallery-title {
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.pv-gallery-placeholder {
    width: 100%;
    height: 250px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* Empty State */
.pv-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.pv-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.pv-empty-title {
    font-size: 20px;
    color: #64748b;
    font-weight: 500;
}

/* Pagination */
.pv-pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pv-pagination .pagination {
    display: flex;
    gap: 5px;
}

.pv-pagination .page-link {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #2563eb;
    text-decoration: none;
    transition: all 0.2s;
}

.pv-pagination .page-link:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

.pv-pagination .active .page-link {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Responsive */
@media (max-width: 768px) {
    .pv-image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .pv-gallery-image {
        height: 150px;
    }

    .pv-gallery-placeholder {
        height: 150px;
        font-size: 32px;
    }

    .pv-categories {
        gap: 8px;
    }

    .pv-category-btn {
        padding: 6px 12px;
        font-size: 14px;
    }
}

/* Slideshow */
.pv-slideshow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-slideshow-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pv-slideshow-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 100px 20px;
    position: relative;
    min-height: 0; /* Important for flexbox */
    overflow: hidden;
}

.pv-slideshow-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s;
    display: block;
}

.pv-slideshow-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.pv-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.pv-slideshow-info {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    padding: 20px 100px 20px;
    min-height: 80px;
    max-height: 150px;
    overflow: hidden;
}

.pv-slideshow-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pv-slideshow-description {
    font-size: 14px;
    opacity: 0.9;
    margin: 0 0 8px 0;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pv-slideshow-meta {
    font-size: 12px;
    opacity: 0.7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.pv-slideshow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.pv-slideshow-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.pv-slideshow-prev {
    left: 20px;
}

.pv-slideshow-next {
    right: 20px;
}

.pv-slideshow-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.pv-slideshow-control-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    box-sizing: border-box;
}

.pv-slideshow-control-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: white;
    stroke: white;
}

.pv-slideshow-control-btn .play-icon,
.pv-slideshow-control-btn .pause-icon {
    flex-shrink: 0;
}

.pv-slideshow-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* Slideshow button on gallery */
.pv-slideshow-trigger {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-gallery-item:hover .pv-slideshow-trigger {
    opacity: 1;
}

.pv-slideshow-trigger:hover {
    background: white;
}

/* Responsive slideshow */
@media (max-width: 768px) {
    .pv-slideshow-image-container {
        padding: 70px 20px 10px;
    }

    .pv-slideshow-info {
        padding: 15px 20px;
        min-height: 60px;
        max-height: 120px;
    }

    .pv-slideshow-title {
        font-size: 16px;
        margin-bottom: 5px;
    }

    .pv-slideshow-description {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .pv-slideshow-meta {
        font-size: 12px;
    }

    .pv-slideshow-prev {
        left: 10px;
        padding: 12px;
    }

    .pv-slideshow-next {
        right: 10px;
        padding: 12px;
    }

    .pv-slideshow-controls {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .pv-slideshow-control-btn {
        padding: 10px;
    }
}

/* Grid Layout Options */
/* Metro Layout - Pinterest-style varied sizes */
.pv-image-gallery.layout-metro {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 200px;
    gap: 15px;
}

.pv-image-gallery.layout-metro .pv-gallery-item:nth-child(5n+1) {
    grid-column: span 2;
    grid-row: span 2;
}

.pv-image-gallery.layout-metro .pv-gallery-item:nth-child(5n+3) {
    grid-row: span 2;
}

/* Masonry Layout - Columns with varying heights */
.pv-image-gallery.layout-masonry {
    column-count: 4;
    column-gap: 20px;
}

.pv-image-gallery.layout-masonry .pv-gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

.pv-image-gallery.layout-masonry .pv-gallery-image {
    height: auto;
}

/* Justified Layout - Equal height rows */
.pv-image-gallery.layout-justified {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pv-image-gallery.layout-justified .pv-gallery-item {
    flex: 1 1 auto;
    height: 250px;
    min-width: 200px;
    max-width: 400px;
}

.pv-image-gallery.layout-justified .pv-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Grid layout (default) - Already defined above */
.pv-image-gallery.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Responsive grid layouts */
@media (max-width: 1024px) {
    .pv-image-gallery.layout-metro {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-auto-rows: 180px;
    }

    .pv-image-gallery.layout-masonry {
        column-count: 3;
    }

    .pv-image-gallery.layout-justified .pv-gallery-item {
        height: 220px;
    }
}

@media (max-width: 768px) {
    .pv-image-gallery.layout-metro {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-auto-rows: 150px;
    }

    .pv-image-gallery.layout-masonry {
        column-count: 2;
        column-gap: 15px;
    }

    .pv-image-gallery.layout-justified .pv-gallery-item {
        height: 180px;
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .pv-image-gallery.layout-metro {
        grid-template-columns: repeat(2, 1fr);
    }

    .pv-image-gallery.layout-masonry {
        column-count: 2;
    }

    .pv-image-gallery.layout-justified {
        flex-direction: column;
    }

    .pv-image-gallery.layout-justified .pv-gallery-item {
        width: 100%;
        max-width: none;
        height: 200px;
    }
}
