.wedding-gallery-upload { 
    margin-bottom: 30px; 
    text-align: center;
}

.wedding-gallery-upload h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.wedding-gallery-upload form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wedding-gallery-upload input[type="file"] {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.wedding-gallery-upload input[type="submit"] {
    padding: 10px 20px;
    background: #000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 400;
    transition: background-color 0.3s;
}

.wedding-gallery-upload input[type="submit"]:hover {
    background: #333;
}

.wedding-gallery h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.gallery-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
    margin: 0 auto;
    border-radius: 8px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-width: 100%;
    margin: 0 auto;
}

.load-more-container {
    text-align: center;
    margin-top: 20px;
}

.load-more-btn {
    padding: 10px 20px;
    background: #000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 400;
    transition: background-color 0.3s;
    font-size: 1rem;
}

.load-more-btn:hover {
    background: #333;
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-item img.loaded {
    opacity: 1;
}

/* Skeleton loader */
.gallery-item .skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: pointer;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox img {
    max-width: 90%;
    max-height: 70%;
    object-fit: contain;
    border-radius: 5px;
}

.gallery-lightbox .lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.gallery-lightbox .lightbox-download {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 400;
    transition: background-color 0.3s;
    z-index: 10001;
}

.gallery-lightbox .lightbox-download:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gallery-lightbox .lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.upload-message { 
    color: green; 
    font-weight: bold; 
    text-align: center;
    margin: 15px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .wedding-gallery-upload h3,
    .wedding-gallery h3 {
        font-size: 1.3rem;
    }
    
    .gallery-lightbox .lightbox-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    
    .gallery-lightbox .lightbox-download {
        padding: 12px 24px;
        font-size: 1rem;
        bottom: 40px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .wedding-gallery-upload h3,
    .wedding-gallery h3 {
        font-size: 1.2rem;
    }
    
    .gallery-lightbox img {
        max-width: 95%;
        max-height: 75%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .gallery-item {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
    
    .gallery-item:active {
        transform: scale(0.98);
    }
    
    .gallery-lightbox .lightbox-close,
    .gallery-lightbox .lightbox-download {
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(2px);
    }
}

/* Performance optimizations */
.gallery-item img {
    will-change: opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

.gallery-grid {
    will-change: transform;
}

/* Smooth loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeIn 0.5s ease-out;
}
