.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

.album-item {
    position: relative;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.album-item:hover img {
    transform: scale(1.1);
}

/* CSS cho cửa sổ Modal */
.modal {
    display: none; /* Switch to 'flex' via JS when opening */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    
    /* Center the image perfectly regardless of orientation */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    /* Maintain original aspect ratio */
    width: auto;
    height: auto;

    /* Logic for Portrait Images: */
    /* This ensures a tall image is never taller than 90% of the screen height */
    max-height: 90vh; 
    
    /* Logic for Landscape Images: */
    /* This ensures a wide image never bleeds off the sides of the screen */
    max-width: 95%;

    /* Keep the image crisp */
    object-fit: contain; 
    border-radius: 4px;
    
    animation: zoom 0.3s ease-in-out;
}

@keyframes zoom {
    from {transform:scale(0)} to {transform:scale(1)}
}

/* Nút Đóng (X) */
.close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover {
    color: #28a745;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-size: 1.1em;
}

/* Tối ưu cho di động */
@media only screen and (max-width: 700px){
    .modal-content {
        width: 95%;
    }
    .album-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cột trên điện thoại */
    }
}


/* Navigation Arrows */
.prev-slide, .next-slide {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    font-weight: bold;
    padding: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
    user-select: none;
    background-color: rgba(0,0,0,0.2);
    border-radius: 5px;
}

.prev-slide { left: 10px; }
.next-slide { right: 10px; }

.prev-slide:hover, .next-slide:hover {
    background-color: rgba(0,0,0,0.8);
    color: #2ecc71; /* Màu xanh lá đặc trưng của Thien Son Travel */
}

/* Modal Content Container */
.modal-content-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 80%;
    animation-name: zoom;
    animation-duration: 0.6s;
}




@keyframes zoom {
    from {transform:scale(0.9); opacity: 0;} 
    to {transform:scale(1); opacity: 1;}
}

