/* Enhanced Gallery Page Styles */

/* Variables */
:root {
    --gallery-gap: 20px;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Page Hero - Matching Inventory Banner */
.page-hero {
    position: relative;
    background-image: url('https://images.unsplash.com/photo-1609766857041-ed402ea8069a?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80');
    background-size: cover;
    background-position: center;
    color: var(--white);
    padding: 60px 0 40px;
    text-align: center;
    margin-top: 70px;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.8) 0%, rgba(51, 51, 51, 0.8) 100%);
}

.page-hero .container {
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--white);
}

.page-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Gallery Section */
.gallery-section {
    padding: 40px 0 80px;
    background: #fafafa;
    min-height: 100vh;
}

.gallery-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Gallery Controls */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 0 10px;
}

.control-group {
    display: flex;
    gap: 1rem;
}

.filter-btn {
    background: white;
    border: 2px solid transparent;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.filter-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.875rem;
}

.filter-btn.active .btn-count {
    background: rgba(255,255,255,0.2);
}

.view-controls {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.view-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
}

.view-btn:hover {
    background: #f0f0f0;
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--secondary-color);
    color: white;
}

/* Gallery Container */
.gallery-container {
    position: relative;
    transition: all 0.5s var(--transition-smooth);
}

/* Masonry Layout */
.gallery-container.masonry-view {
    column-count: 4;
    column-gap: var(--gallery-gap);
}

.gallery-container.masonry-view .gallery-item {
    break-inside: avoid;
    margin-bottom: var(--gallery-gap);
}

/* Grid Layout */
.gallery-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--gallery-gap);
}

/* List Layout */
.gallery-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-container.list-view .gallery-item {
    display: flex;
    height: 200px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.gallery-container.list-view .gallery-image {
    width: 300px;
    height: 100%;
}

/* Gallery Items */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    transition: all 0.4s var(--transition-smooth);
}

.gallery-item:nth-child(n) {
    animation-delay: calc(var(--index) * 0.03s);
}

@keyframes galleryItemIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Random heights for masonry */
.gallery-item:nth-child(4n+1) { aspect-ratio: 1 / 1.2; }
.gallery-item:nth-child(4n+2) { aspect-ratio: 1 / 0.8; }
.gallery-item:nth-child(4n+3) { aspect-ratio: 1 / 1; }
.gallery-item:nth-child(4n) { aspect-ratio: 1 / 1.4; }

.gallery-image {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--transition-smooth);
    will-change: transform;
}

/* Advanced Hover Effects */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.gallery-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item:hover img {
    transform: scale(1.1) rotate(2deg);
}

/* Gallery Info Overlay */
.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.4s var(--transition-smooth);
    z-index: 2;
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
}

.gallery-number {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 5px;
}

.gallery-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
}

.gallery-actions {
    display: flex;
    gap: 10px;
}

.gallery-action {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.gallery-action:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

/* Enhanced Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(20px);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close span {
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.lightbox-close span:first-child {
    transform: rotate(45deg);
}

.lightbox-close span:last-child {
    transform: rotate(-45deg);
}

.lightbox-close:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: rotate(90deg);
}

.lightbox-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 120px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-nav:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s var(--transition-smooth);
}

.lightbox.active .lightbox-image {
    opacity: 1;
    transform: scale(1);
}

/* Lightbox Info */
.lightbox-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.lightbox-counter {
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lightbox-counter .separator {
    opacity: 0.5;
}

.lightbox-actions {
    display: flex;
    gap: 15px;
}

.action-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.action-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.action-btn.primary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.action-btn.primary:hover {
    background: #b89651;
    border-color: #b89651;
}

/* Lightbox Thumbnails */
.lightbox-thumbnails {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    padding: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) transparent;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s ease;
}

.lightbox.active .lightbox-thumbnails {
    opacity: 1;
    transform: translateY(0);
}

.thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--secondary-color);
}

.thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Button Hover Effects */
.btn-hover-lift {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-hover-lift::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.1);
    transition: left 0.4s ease;
}

.btn-hover-lift:hover::before {
    left: 100%;
}

.btn-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transition: all 0.1s ease;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
}

.cursor-outline {
    width: 30px;
    height: 30px;
    border: 2px solid var(--secondary-color);
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-container.masonry-view {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .page-hero {
        padding: 50px 0 30px;
    }

    .page-title {
        font-size: 2rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .gallery-section {
        padding: 30px 0 60px;
    }

    .gallery-container.masonry-view {
        column-count: 2;
    }

    .gallery-controls {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .control-group {
        width: 100%;
        justify-content: center;
    }

    .filter-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    /* Lightbox mobile */
    .lightbox-container {
        padding: 60px 10px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }

    .lightbox-info {
        flex-direction: column;
        gap: 10px;
        bottom: -80px;
        padding: 15px;
    }

    .lightbox-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .action-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .lightbox-thumbnails {
        height: 70px;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
    }

    .cursor-dot,
    .cursor-outline {
        display: none;
    }

    .gallery-item:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .page-hero {
        padding: 40px 0 25px;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .page-subtitle {
        font-size: 0.95rem;
    }

    .gallery-container.masonry-view {
        column-count: 1;
    }

    .gallery-container.grid-view {
        grid-template-columns: 1fr;
    }

    .view-controls {
        display: none;
    }

    .gallery-wrapper {
        padding: 0 10px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}