/* Portfolio Gallery Modal */
.portfolio-gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-gallery-modal.active {
    display: flex;
    opacity: 1;
}

.gallery-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gallery-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gallery-image-container img {
    max-width: 90%;
    max-height: 75%;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.gallery-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: background 0.3s ease;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-navigation {
    position: fixed;
    bottom: 20%;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0;
    pointer-events: none; /* This allows clicks to pass through to the image */
    z-index: 10;
}

.gallery-prev,
.gallery-next {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 80px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto; /* Re-enable clicks on the buttons */
    position: fixed;
    margin: 0;
    bottom: 20%;
}

.gallery-prev {
    border-radius: 0 4px 4px 0;
    left: 0;
}

.gallery-next {
    border-radius: 4px 0 0 4px;
    right: 0;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: rgba(0, 0, 0, 0.7);
    width: 60px;
}

.gallery-info {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    direction: rtl;
    text-align: right;
    min-height: 120px;
}

.gallery-title {
    font-size: 24px;
    margin: 0 0 5px 0;
    font-weight: 700;
}

.gallery-category {
    display: inline-block;
    background: linear-gradient(45deg, #ff8473, #ff7062);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.gallery-description {
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .gallery-image-container img {
        max-width: 85%;
        max-height: 70%;
    }
}

@media (max-width: 992px) {
    .gallery-image-container {
        padding: 15px;
    }
    
    .gallery-image-container img {
        max-width: 90%;
        max-height: 65%;
    }
    
    .gallery-info {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .gallery-image-container img {
        max-width: 95%;
        max-height: 60%;
    }
    
    .gallery-info {
        padding: 15px;
        min-height: 100px;
    }
    
    .gallery-title {
        font-size: 20px;
    }
    
    .gallery-description {
        font-size: 14px;
    }
    
    .gallery-navigation {
        bottom: 30%;
    }
    
    .gallery-prev,
    .gallery-next {
        width: 40px;
        height: 60px;
        font-size: 18px;
        bottom: 30%;
    }
    
    .gallery-prev:hover,
    .gallery-next:hover {
        width: 45px;
    }
    
    .gallery-navigation {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .gallery-image-container {
        padding: 10px;
    }
    
    .gallery-image-container img {
        max-width: 100%;
        max-height: 55%;
        box-shadow: none;
    }
    
    .gallery-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 35px;
        height: 35px;
    }
    
    .gallery-navigation {
        bottom: 35%;
    }
    
    .gallery-prev,
    .gallery-next {
        width: 35px;
        height: 50px;
        font-size: 16px;
        bottom: 35%;
    }
    
    .gallery-prev:hover,
    .gallery-next:hover {
        width: 40px;
    }
    
    .gallery-info {
        padding: 10px;
    }
}

/* Landscape orientation - optimized for landscape images */
@media (orientation: landscape) {
    .gallery-modal-content {
        flex-direction: row;
    }
    
    .gallery-image-container {
        width: 75%;
        height: 100%;
        padding: 20px;
    }
    
    .gallery-image-container img {
        max-width: 95%;
        max-height: 90%;
    }
    
    .gallery-info {
        width: 25%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-y: auto;
    }
    
    .gallery-navigation {
        bottom: 15%;
    }
    
    .gallery-prev,
    .gallery-next {
        bottom: 15%;
    }
}

/* Small landscape devices */
@media (orientation: landscape) and (max-height: 500px) {
    .gallery-image-container {
        padding: 10px;
    }
    
    .gallery-image-container img {
        max-height: 85%;
    }
    
    .gallery-info {
        padding: 10px;
    }
    
    .gallery-title {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .gallery-category {
        margin-bottom: 5px;
        padding: 2px 8px;
        font-size: 12px;
    }
    
    .gallery-description {
        font-size: 13px;
        line-height: 1.3;
    }
}
