/* Gallery Styles */

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.6s ease-in;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2.5rem;
    }
}

/* Gallery Item */
.gallery-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    transition: all 0.3s ease;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item.hidden {
    display: none;
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }
.gallery-item:nth-child(9) { animation-delay: 0.45s; }
.gallery-item:nth-child(10) { animation-delay: 0.5s; }

/* Gallery Item Inner */
.gallery-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    aspect-ratio: 3/4;
}

.gallery-item-inner:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Gallery Image */
.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-inner:hover .gallery-image {
    transform: scale(1.1);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(25, 55, 35, 0.9) 0%, rgba(25, 55, 35, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item-inner:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    animation: zoomPulse 1.5s ease-in-out infinite;
}

@keyframes zoomPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Filter Buttons */
.gallery-filter-btn {
    position: relative;
    overflow: hidden;
}

.gallery-filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.gallery-filter-btn:hover::before {
    width: 300px;
    height: 300px;
}

.gallery-filter-btn.active {
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    color: white;
    border-color: #193723;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Lightbox Controls */
.lightbox-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-nav:hover i {
    animation: slideNav 0.6s ease infinite;
}

@keyframes slideNav {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

.lightbox-prev:hover i {
    animation: slideNavLeft 0.6s ease infinite;
}

@keyframes slideNavLeft {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-5px);
    }
}

/* Lightbox Counter */
.lightbox-counter {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    z-index: 10000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }

    .lightbox-nav {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .lightbox-counter {
        bottom: 1rem;
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .lightbox-content {
        max-width: 95vw;
        max-height: 80vh;
    }

    .lightbox-content img {
        max-height: 80vh;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Transitions */
.gallery-item.filtering {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item.filtering.hidden {
    opacity: 0;
    transform: scale(0.8);
}

/* Loading State */
.gallery-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Empty State */
.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.gallery-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.gallery-empty h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-empty p {
    font-size: 1rem;
    opacity: 0.7;
}

/* Index Page Pagination Styles */
.index-pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.index-pagination-btn {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #193723;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.index-pagination-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.index-pagination-btn span {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.index-pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px -5px rgba(25, 55, 35, 0.3);
    border-color: #193723;
}

.index-pagination-btn:hover:not(:disabled)::before {
    opacity: 0.1;
}

.index-pagination-btn.active {
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    color: white;
    border-color: #D4AF37;
    box-shadow: 0 4px 15px -3px rgba(25, 55, 35, 0.4);
    animation: indexPageActive 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.index-pagination-btn.active::before {
    opacity: 1;
}

.index-pagination-btn.active span {
    color: white;
}

.index-pagination-btn:disabled {
    background: #f3f4f6;
    color: #d1d5db;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.index-pagination-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

@keyframes indexPageActive {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.index-pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    color: white;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.index-pagination-nav::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.index-pagination-nav:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.index-pagination-nav:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(25, 55, 35, 0.4);
    border-color: #D4AF37;
}

.index-pagination-nav:hover:not(:disabled) i {
    animation: indexBounceArrow 0.6s ease infinite;
}

.index-pagination-nav:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.index-pagination-nav:disabled:hover {
    transform: none;
    box-shadow: none;
}

.index-pagination-nav i {
    font-size: 1.125rem;
    position: relative;
    z-index: 1;
}

@keyframes indexBounceArrow {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(4px);
    }
}

.index-pagination-nav:first-child:hover:not(:disabled) i {
    animation: indexBounceArrowLeft 0.6s ease infinite;
}

@keyframes indexBounceArrowLeft {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-4px);
    }
}

/* Product Grid Animation for Index */
.products-changing .product-card {
    animation: indexProductOut 0.3s ease-out forwards;
}

@keyframes indexProductOut {
    to {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
}

.products-loaded .product-card {
    animation: indexProductIn 0.4s ease-out forwards;
}

@keyframes indexProductIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.product-card:nth-child(1) { animation-delay: 0s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.2s; }
.product-card:nth-child(4) { animation-delay: 0.3s; }

/* Collections Section Pagination */
.collections-changing .wine-card {
    animation: indexProductOut 0.3s ease-out forwards;
}

.collections-loaded .wine-card {
    animation: indexProductIn 0.4s ease-out forwards;
}

.wine-card:nth-child(1) { animation-delay: 0s; }
.wine-card:nth-child(2) { animation-delay: 0.1s; }
.wine-card:nth-child(3) { animation-delay: 0.2s; }

/* Mobile Responsive for Index Pagination */
@media (max-width: 640px) {
    .index-pagination-container {
        gap: 0.375rem;
        margin-top: 2rem;
    }

    .index-pagination-btn {
        min-width: 2.25rem;
        height: 2.25rem;
        font-size: 0.8125rem;
    }

    .index-pagination-nav {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .index-pagination-nav i {
        font-size: 1rem;
    }
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    color: white;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pagination-nav::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.pagination-nav:hover::before {
    width: 300px;
    height: 300px;
}

.pagination-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(25, 55, 35, 0.4);
    border-color: #D4AF37;
}

.pagination-nav:active {
    transform: translateY(0);
}

.pagination-nav:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: transparent;
}

.pagination-nav:disabled:hover {
    transform: none;
    box-shadow: none;
}

.pagination-nav:disabled::before {
    display: none;
}

.pagination-nav i {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.pagination-nav:not(:disabled):hover i {
    animation: bounceHorizontal 0.6s ease infinite;
}

.pagination-nav-text {
    position: relative;
    z-index: 1;
}

@keyframes bounceHorizontal {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

.pagination-nav:first-child:not(:disabled):hover i {
    animation: bounceHorizontalLeft 0.6s ease infinite;
}

@keyframes bounceHorizontalLeft {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-5px);
    }
}

/* Pagination Numbers */
.pagination-numbers {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-number {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #4b5563;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pagination-number::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pagination-number span {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.pagination-number:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px -5px rgba(25, 55, 35, 0.3);
    border-color: #193723;
}

.pagination-number:hover::before {
    opacity: 0.1;
}

.pagination-number.active {
    background: linear-gradient(135deg, #193723 0%, #1f4429 100%);
    color: white;
    border-color: #D4AF37;
    box-shadow: 0 4px 15px -3px rgba(25, 55, 35, 0.4);
    animation: pageActive 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-number.active::before {
    opacity: 1;
}

.pagination-number.active span {
    color: white;
}

@keyframes pageActive {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pagination-ellipsis {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-weight: 600;
    font-size: 0.875rem;
    animation: ellipsisPulse 2s ease-in-out infinite;
}

@keyframes ellipsisPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Pagination Animation on Page Change */
.pagination-changing .gallery-item {
    animation: pageChangeOut 0.3s ease-out forwards;
}

@keyframes pageChangeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.pagination-changing.pagination-loaded .gallery-item {
    animation: pageChangeIn 0.4s ease-out forwards;
}

@keyframes pageChangeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .pagination-container {
        gap: 0.5rem;
    }

    .pagination-nav {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }

    .pagination-nav-text {
        display: none;
    }

    .pagination-nav i {
        font-size: 1.125rem;
        margin: 0;
    }

    .pagination-number {
        min-width: 2.25rem;
        height: 2.25rem;
        font-size: 0.8125rem;
    }

    .pagination-ellipsis {
        min-width: 2.25rem;
        height: 2.25rem;
    }
}
