/* Gallery styling */
.gallery {
    display: flex;
    gap: 20px;
    padding: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail {
    width: 200px;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: zoomIn 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);

    /* Key properties for original size */
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    /* Ensure no flex/grid constraints */
    flex: none;
    align-self: auto;
}

@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
}

.close:hover {
    color: #ff6b6b;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.prev-arrow {
    left: 30px;
}

.next-arrow {
    right: 30px;
}

.nav-arrow svg {
    width: 24px;
    height: 24px;
}

/* Loading Spinner */
.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 1002;
}

.spinner-circle {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-text {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.spinner.active {
    display: flex;
}

/* Caption */
.caption {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 24px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    max-width: 80%;
    word-wrap: break-word;
}

/* Image Counter */
.image-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* Responsive design */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .close {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 35px;
        height: 35px;
    }
    
    .nav-arrow {
        width: 40px;
        height: 40px;
    }
    
    .prev-arrow {
        left: 15px;
    }
    
    .next-arrow {
        right: 15px;
    }
    
    .nav-arrow svg {
        width: 20px;
        height: 20px;
    }
    
    .caption {
        font-size: 16px;
        bottom: 50px;
        padding: 10px 20px;
    }
    
    .image-counter {
        font-size: 12px;
        bottom: 15px;
    }
    
    .spinner-circle {
        width: 40px;
        height: 40px;
    }
    
    .spinner-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .nav-arrow {
        width: 35px;
        height: 35px;
    }
    
    .nav-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .caption {
        font-size: 14px;
        max-width: 90%;
    }
}