.ea4v-texteditor-add-image-popup .ts-file-list {
    grid-template-columns: repeat(2, 1fr);
}

@media screen and (min-width: 768px) {
    .ea4v-texteditor-add-image-popup .ts-file-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* Edit Popup Styles */
.ea4v-edit-preview img {
    width: 100%;
    height: auto;
    border-radius: 11px;
    display: block;
    margin: 0 auto;
    border: 1px solid #7c7c7c;
}


.ea4v-texteditor-edit-image-popup .ts-popup-content-wrapper {
    max-height: 90vh !important;
}

@media screen and (min-width: 900px) {
    .ea4v-edit-layout {
        display: flex !important;
        flex-direction: row !important;
        gap: 25px;
        align-items: flex-start;
        width: 100%;
    }

    .ea4v-edit-preview {
        flex: 0 0 35%;
        max-width: 35%;
        position: sticky;
        top: 0;
    }

    .ea4v-edit-options {
        flex: 1;
    }
}

/* Edit button overlay for images in TinyMCE - injected by JS but good to have fallback/reference */
.ea4v-image-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    z-index: 100;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.ea4v-image-edit-btn:hover {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Uploading State */
.ea4v-uploading .ts-file-info {
    display: flex !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(15 15 15 / 75%);
    z-index: 5;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.ea4v-uploading .ts-loader-wrapper {
    margin: 0 !important;
    margin-bottom: 8px !important;
    width: 100%;
    height: unset !Important;
}

/* Hide TinyMCE scrollbar but keep scroll functionality */
.mce-content-body {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.mce-content-body::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Ensure iframe itself also hides scrollbar */
iframe.tox-edit-area__iframe {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

iframe.tox-edit-area__iframe::-webkit-scrollbar {
    display: none;
}

.ea4v-texteditor-popup .ts-popup-root {
    pointer-events: unset !important;
}