/* ویرایشگر رسانه‌های پست (media-editor.php) */
.media-editor {
    direction: rtl;
    margin: 12px;
    padding: 14px;
    border: 1px dashed #c9d8f2;
    border-radius: 14px;
    background: #f8faff;
    text-align: right;
}
.media-editor-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-bottom: 12px;
}
.media-editor-head strong {
    font-size: .95rem;
    color: #1f2937;
}
.media-editor-hint {
    font-size: .75rem;
    color: #6b7280;
}
.media-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}
.media-editor-tile,
.media-editor-add {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
}
.media-editor-tile {
    background: #e5e7eb;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}
.media-editor-thumb {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-editor-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-editor-icon {
    font-size: 28px;
    color: #6b7280;
}
.media-editor-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: .68rem;
}
.media-editor-progress {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: rgba(255, 255, 255, .7);
    color: #1f2937;
    font-size: .8rem;
    font-weight: bold;
    text-align: center;
    direction: ltr;
}
.media-editor-tile:not(.is-pending):not(.is-failed) .media-editor-progress {
    display: none;
}
.media-editor-tile.is-pending .media-editor-move {
    visibility: hidden;
}
.media-editor-tile.is-failed .media-editor-progress {
    background: rgba(254, 226, 226, .92);
    color: #b91c1c;
    direction: rtl;
}

.media-editor-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    padding: 5px;
    background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent);
}
.media-editor-actions button,
.media-editor-restore {
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.media-editor-actions button {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #111827;
    font-size: 20px;
    line-height: 1;
}
.media-editor-actions button:hover {
    background: #fff;
}
.media-editor-actions .media-editor-remove {
    background: #ef4444;
    color: #fff;
}
.media-editor-actions .media-editor-remove:hover {
    background: #dc2626;
}
/* اولین و آخرین کاشی جای جابه‌جایی به آن سمت ندارند */
.media-editor-tile:first-child .media-editor-move[data-dir="-1"],
.media-editor-tile:nth-last-child(2) .media-editor-move[data-dir="1"] {
    visibility: hidden;
}

.media-editor-removed-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(17, 24, 39, .72);
    color: #fff;
    font-size: .8rem;
}
.media-editor-tile.is-removed .media-editor-removed-overlay {
    display: flex;
}
.media-editor-tile.is-removed .media-editor-actions {
    display: none;
}
.media-editor-restore {
    padding: 4px 12px;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: .75rem;
}

.media-editor-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0;
    border: 2px dashed #9db8e8;
    background: #fff;
    color: #2e66bf;
    font-size: .78rem;
    text-align: center;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.media-editor-add:hover {
    background: #e8f0fc;
    border-color: #2e66bf;
}
.media-editor-add-plus {
    font-size: 30px;
    line-height: 1;
}
.media-editor-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.media-editor-status {
    margin: 10px 0 0;
    font-size: .8rem;
    color: #6b7280;
}
.media-editor-status:empty {
    display: none;
}
.media-editor-status.is-error {
    color: #b91c1c;
}

@media screen and (max-width: 600px) {
    .media-editor {
        margin: 10px 8px;
        padding: 10px;
    }
    .media-editor-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}
