/* Thumbnail Grid Styles */
.ega-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.ega-thumbnail {
    cursor: pointer;
    overflow: hidden;
    width:100% !important;
    aspect-ratio:1/1;
    border: 1px solid #ddd;
    box-sizing: border-box;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

.ega-thumbnail:hover {
    transform: scale(1.05);
}

/* Modal Styles */
.ega-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 10000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ega-modal-container {
    position: relative;
    max-width: 1100px;
    width: 100%;
    padding: 0 60px; /* Space for arrows */
}

.ega-modal-content {
    background-color: #fff;
    padding: 40px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    gap: 30px;
    border: 1px solid #EAEAEA;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.ega-modal-left {
    flex-basis: 50%;
}

.ega-modal-right {
    flex-basis: 50%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ega-modal-patient-name {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ega-modal-main-image,
.ega-modal-before-image,
.ega-modal-after-image {
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ega-modal-main-image {
    padding-bottom: 100%; /* Aspect ratio 1:1 */
}

.ega-modal-before-image,
.ega-modal-after-image {
    padding-bottom: 60%; /* Aspect ratio 5:3 */
}

.ega-modal-right h4 {
    margin: 0 0 5px 0;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 600;
    color: #888;
}

.ega-modal-procedure {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 50px; /* Space for close button */
}

/* Modal Navigation and Close Button */
.ega-modal-close {
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #333;
    background: #fff;
    padding: 6px 12px;
    border: 1.5px solid #000;
    transition: all 0.2s ease;
}

.ega-modal-close:hover {
    background-color: #333;
    color: #fff;
}

.ega-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    background-color: #000;
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background-color 0.3s ease;
}

.ega-modal-prev {
    left: 0px;
}

.ega-modal-next {
    right: 0px;
}

/* --- Responsive Styles --- */
@media (max-width: 992px) {
    .ega-modal-content {
        flex-direction: column;
        max-height: 85vh;
        overflow-y: auto;
        padding: 25px;
    }
}

@media (max-width: 767px) {
    .ega-modal-container {
        padding: 0;
    }
    .ega-modal-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: 25%; /* Move arrows up onto the image area */
    }
    .ega-modal-prev {
        left: 10px;
    }
    .ega-modal-next {
        right: 10px;
    }
    .ega-modal-content {
        gap: 20px;
    }
}