.gallery-container {
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    align-items: flex-start;
    gap: 10px;
    padding: 5px;
    box-sizing: border-box;
}

.gallery-item {
    position: relative;
    height: 40vh;
    flex-grow: 1;
    overflow: hidden;
    cursor: pointer;
    background-color: #f0f0f0;
    min-width: 200px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    opacity: 0;
    animation: fadeIn 1s ease-in forwards;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.photo-container .like-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s ease;
}

.photo-container .like-btn:hover {
    transform: scale(1.1);
}

.photo-container .like-btn.liked {
    background-image: url('../assets/icons/heart-filled.svg');
}

.photo-container .like-btn:not(.liked) {
    background-image: url('../assets/icons/heart-empty.svg');
}

.photo-container .like-count {
    position: absolute;
    bottom: 10px;
    right: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    display: none;
}

.photo-container .like-btn:hover + .like-count,
.photo-container .like-count:hover {
    display: inline-block;
}

.like-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    user-select: none;
}

.like-button .like-count {
    display: none;
    position: absolute;
    bottom: 25px;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 2px 4px;
    border-radius: 12px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.2s;
}

.like-button:hover .like-count {
    display: block;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    pointer-events: auto;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    min-width: 90vw;
    min-height: 90vh;
    object-fit: contain;
    background: transparent;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    opacity: 0;
    animation: fadeIn 1s ease-in forwards;
}

.modal-like-button {
    position: absolute;
    bottom: 30px;
    right: 0px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.modal-like-button .like-count {
    display: none;
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 20px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.2s;
}

.modal-like-button:hover .like-count {
    display: block;
}

.close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 3;
    filter: invert(1);
    transition: transform 0.2s ease;
}

.close:hover {
    transform: scale(1.1);
}

.download-btn {
    position: absolute;
    top: 5px;
    left: calc(50% - 104px);
    transform: translateX(-50%);
    padding: 10px 20px;
    background-color: #fff;
    color: #000;
    text-decoration: none;
    border-radius: 5px;
    position: relative;
    z-index: 3;
}

.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    padding: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 3;
    height: auto;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.prev {
    left: 0;
}

.next {
    right: 0;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

.gallery::after {
    content: '';
    flex-grow: 999999;
    min-width: 200px;
    margin: 5px;
}

.heart {
    color: white;
    font-size: 16px;
    transition: color 0.3s, transform 0.3s;
}

.modal-like-button .heart {
    font-size: 30px;
}

.heart.liked {
    color: #ff4444;
    transform: scale(1.2);
}

.like-button:hover .heart,
.modal-like-button:hover .heart {
    transform: scale(1.2);
}

@media screen and (max-width: 768px) {
    .gallery-item {
        height: auto;
        width: calc(50% - 10px);
        min-width: auto;
    }
    
    .gallery-item img {
        object-fit: contain;
    }
}

@media screen and (max-width: 480px) {
    .gallery-item {
        width: 100%;
        height: auto;
        min-width: 100%;
    }
    
    .gallery-item img {
        width: 100%;
        height: auto;
        max-height: none;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
