/* Modal overlay background */
.cb-image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    /* Semi-transparent black background */
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Modal open state */
.cb-image-modal-overlay.cb-modal-show {
    opacity: 1;
    visibility: visible;
}

/* Positioning wrapper to keep close button relative to content */
.cb-image-modal-wrapper {
    position: relative;
    width: 90%;
    max-width: 800px;
    /* Optional max width, can be overridden */
    display: flex;
    flex-direction: column;
}

/* Modal content container - handling the vertical scroll */
.cb-image-modal-content {
    width: 100%;
    max-height: 90vh;
    /* Keeps it within the viewport */
    overflow-y: auto;
    /* Enable vertical scrolling */
    overflow-x: hidden;
    background: transparent;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Customizing the scrollbar for webkit browsers */
.cb-image-modal-content::-webkit-scrollbar {
    width: 8px;
}

.cb-image-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cb-image-modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.cb-image-modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* The image itself inside the modal */
.cb-image-modal-content img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
}

/* Close button - sticking to the top right of the modal wrapper */
.cb-image-modal-close {
    align-self: flex-end;
    margin-bottom: 10px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.cb-image-modal-close:hover,
.cb-image-modal-close:focus {
    color: #ccc;
    text-decoration: none;
    outline: none;
}

/* Optional pointer cursor for the trigger class */
.cb-image-modal-trigger,
.cb-image-modal-trigger img {
    cursor: pointer;
}