body {
    margin: 0;
    overflow-x: hidden;
    display: flex;
    height: 100vh;
    flex-direction: column;
    background-color: #ffffff;
    transition: transform 0.3s ease-in-out;
}

@media (min-width: 992px) {
    body { flex-direction: row; }
}

#nav {
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    height: 50px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 10px;
}

@media (min-width: 768px) {
    #nav {
        width: 50px;
        height: 100vh;
        border-bottom: none;
        border-right: 1px solid #ddd;
        flex-direction: column;
        justify-content: flex-start;
        padding: 10px 0;
    }
}

#menuIcon {
    cursor: pointer;
    display: inline-block;
    width: 30px;
    height: 24px;
    position: relative;
    transition: transform 0.3s ease-in-out;
}

#menuIcon div {
    width: 100%;
    height: 3px;
    background-color: black;
    position: absolute;
    transition: all 0.3s ease;
}

#menuIcon div:nth-child(1) { top: 0; }
#menuIcon div:nth-child(2) { top: 10px; }
#menuIcon div:nth-child(3) { top: 20px; }

#menuIcon.open div:nth-child(1) { transform: rotate(45deg); top: 10px; }
#menuIcon.open div:nth-child(2) { opacity: 0; }
#menuIcon.open div:nth-child(3) { transform: rotate(-45deg); top: 10px; }

.menu {
    height: 100%;
    width: 300px;
    position: fixed;
    z-index: 1001;
    top: 0;
    left: -300px;
    background-color: white;
    overflow-x: hidden;
    transition: 0.3s;
    padding-top: 60px;
}

.menu a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: black;
    display: block;
    transition: 0.3s;
}

.menu a:hover { background-color: #444; color: #fff; }

.main-content {
    margin-top: 50px;
    flex-grow: 1;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .main-content { margin-top: 0; margin-left: 50px; }
}

.grid-images {
    margin: 10px;
    gap: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    background-color: #ffffff;
}

@media (min-width: 768px) {
    .grid-images { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

.grid-item {
    position: relative;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.grid-item img {
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    display: block;
    object-fit: cover;
    object-position: center center;
}

.grid-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, background-color 0.5s ease-in-out;
}

.grid-item:hover img { opacity: 0; }
.grid-item:hover .overlay { opacity: 1; }

#loader {
    width: auto;
    height: auto;
    left: calc(50% - 34px);
    top: calc(50% - 34px);
    padding: 10px;
    border-radius: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.modalX {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: top center;
    position: absolute;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(222, 222, 222, 0.9);
    transform: translateX(100vw);
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
}

.modalX img {
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: block;
    transition: opacity 0.5s ease-in-out;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    user-select: none;
    transition: 0.3s;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
}

.prev { left: 10px; }
.next { right: 10px; }

.prev:hover, .next:hover { background-color: rgba(0, 0, 0, 0.8); }

.grid-container {
    padding: 0;
    margin: 0;
    height: calc(100vh - 50px);
    overflow-x: hidden;
    position: relative;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .grid-container { height: 100vh; }
}
