/* Herramientas de imagen del RadzenHtmlEditor (ver wwwroot/js/html-editor-images.js) */

[data-fx-image-tools] .rz-html-editor-content img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
}

[data-fx-image-tools] .rz-html-editor-content .fx-gallery {
    outline: 1px dashed rgba(99, 102, 241, .35);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Botón "Imágenes / GIF" de la barra del editor */
.fx-img-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    height: 30px;
    padding: 0 .65rem;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

    .fx-img-tool-btn:hover { background: #e0e7ff; }
    .fx-img-tool-btn i { font-size: 1rem; }

.fx-img-hint {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    padding: .45rem .75rem;
    border-top: 1px solid #eef0f4;
    color: #6b7280;
    font-size: .72rem;
    line-height: 1.35;
}

    .fx-img-hint i { color: #6366f1; font-size: .9rem; }

.fx-img-hint-link {
    padding: 0;
    border: 0;
    background: none;
    color: #4f46e5;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

    .fx-img-hint-link:hover { color: #3730a3; }

/* ───────── Barra del editor siempre a mano ─────────
   Se queda pegada bajo la cabecera de la app al bajar por el texto. Radzen pone overflow:hidden al editor,
   que impide el sticky: overflow:clip recorta igual sin crear contenedor de scroll.
   --fx-editor-sticky-top lo calcula html-editor-images.js con la altura de .app-header. */
[data-fx-image-tools] .rz-html-editor {
    overflow: visible;
    overflow: clip;
}

[data-fx-image-tools] .rz-html-editor-toolbar {
    position: sticky;
    top: var(--fx-editor-sticky-top, 0px);
    z-index: 5;
    transition: box-shadow .15s ease;
}

    [data-fx-image-tools] .rz-html-editor-toolbar.is-stuck {
        box-shadow: 0 8px 16px -8px rgba(15, 23, 42, .28);
    }

/* Botón de ayuda (?) al final de la barra */
.fx-help-tool-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-left: auto;
    padding: 0;
    border: 1px solid #c7d2fe;
    border-radius: 50%;
    background: #fff;
    color: #4f46e5;
    cursor: pointer;
    align-self: center;
}

    .fx-help-tool-btn i { font-size: 1.05rem; }
    .fx-help-tool-btn:hover { background: #eef2ff; }

[data-theme-mode="dark"] .fx-help-tool-btn { border-color: rgba(165, 180, 252, .4); background: transparent; color: #a5b4fc; }
[data-theme-mode="dark"] .fx-help-tool-btn:hover { background: rgba(99, 102, 241, .18); }
    .fx-help-tool-btn:focus-visible,
    .fx-img-hint-link:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }

/* Ventana de la guía */
.fx-guide-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    overscroll-behavior: contain;
    animation: fx-guide-in .16s ease-out;
}

@keyframes fx-guide-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fx-guide-card {
    display: flex;
    flex-direction: column;
    width: min(900px, 100%);
    height: min(860px, 100%);
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}

.fx-guide-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid #eef0f4;
    color: #111827;
    font: 600 14px system-ui, sans-serif;
}

    .fx-guide-head > i { color: #4f46e5; font-size: 18px; }

.fx-guide-ext {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 6px 10px;
    border-radius: 8px;
    color: #4f46e5;
    font-size: 12.5px;
    text-decoration: none;
}

    .fx-guide-ext:hover { background: #eef2ff; }

.fx-guide-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #374151;
    font-size: 20px;
    cursor: pointer;
}

    .fx-guide-close:hover { background: #f3f4f6; }

.fx-guide-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: #f6f6fb;
}

.fx-guide-modal.is-dark .fx-guide-card { background: #1c1b2c; }
.fx-guide-modal.is-dark .fx-guide-head { border-bottom-color: #34334d; color: #eeedf7; }
.fx-guide-modal.is-dark .fx-guide-head > i,
.fx-guide-modal.is-dark .fx-guide-ext { color: #8b85ff; }
.fx-guide-modal.is-dark .fx-guide-ext:hover,
.fx-guide-modal.is-dark .fx-guide-close:hover { background: #2b2a52; }
.fx-guide-modal.is-dark .fx-guide-close { color: #eeedf7; }
.fx-guide-modal.is-dark .fx-guide-frame { background: #13121f; }

@media (max-width: 576px) {
    .fx-guide-modal { padding: 0; }
    .fx-guide-card { width: 100%; height: 100%; border-radius: 0; }
    .fx-guide-ext span { display: none; }
}

/* Marco + tirador sobre la imagen seleccionada */
.fx-img-frame {
    position: fixed;
    z-index: 1060;
    pointer-events: none;
    outline: 2px solid #6366f1;
    outline-offset: 1px;
    border-radius: 2px;
}

.fx-img-handle {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #6366f1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    cursor: nwse-resize;
    pointer-events: auto;
    touch-action: none;
}

    .fx-img-handle.is-left {
        right: auto;
        left: -7px;
        cursor: nesw-resize;
    }

.fx-img-badge {
    position: absolute;
    left: 6px;
    top: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(17, 24, 39, .78);
    color: #fff;
    font: 600 11px/18px system-ui, sans-serif;
}

/* Barra flotante */
.fx-img-bar {
    position: fixed;
    z-index: 1061;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
    font: 500 12px/1 system-ui, sans-serif;
    user-select: none;
    max-width: calc(100vw - 16px);
    flex-wrap: wrap;
}

.fx-img-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #374151;
    font: inherit;
    cursor: pointer;
}

    .fx-img-btn i { font-size: 15px; }
    .fx-img-btn:hover { background: #f3f4f6; }
    .fx-img-btn.is-active { background: #6366f1; color: #fff; }
    .fx-img-btn.is-danger { color: #dc2626; }
    .fx-img-btn.is-danger:hover { background: #fee2e2; }

.fx-img-sep {
    width: 1px;
    height: 18px;
    margin: 0 3px;
    background: #e5e7eb;
}

.fx-img-label {
    padding: 0 6px;
    color: #6b7280;
    font-weight: 600;
}

body.fx-img-resizing,
body.fx-img-resizing * {
    cursor: nwse-resize !important;
    user-select: none !important;
}

/* ───────── Fase 2: bloques, fila secundaria, modal 3D ───────── */

.fx-block-tool-btn {
    border-color: #a5b4fc;
    background: #4f46e5;
    color: #fff;
}

    .fx-block-tool-btn:hover { background: #4338ca; }

.fx-img-frame.is-block {
    outline: 2px dashed rgba(99, 102, 241, .55);
    outline-offset: 4px;
}

.fx-img-subrow {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #eef0f4;
}

.fx-img-subrow.fx-form { gap: 6px; }

    .fx-img-subrow.fx-form input {
        flex: 1 1 140px;
        min-width: 0;
        height: 30px;
        padding: 0 8px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font: 13px system-ui, sans-serif;
        outline: none;
    }

        .fx-img-subrow.fx-form input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
        .fx-img-subrow.fx-form input.is-error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

/* Menú "+ Bloque" */
.fx-block-menu {
    position: fixed;
    z-index: 1062;
    width: 290px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .2);
    font-family: system-ui, sans-serif;
    animation: fx-menu-in .14s ease-out;
}

@keyframes fx-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.fx-block-menu-title {
    padding: 6px 8px 4px;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.fx-block-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

    .fx-block-item:hover { background: #f5f5ff; }

    .fx-block-item > i {
        display: grid;
        flex: 0 0 34px;
        place-items: center;
        height: 34px;
        border-radius: 8px;
        background: #eef2ff;
        color: #4f46e5;
        font-size: 18px;
    }

    .fx-block-item strong { display: block; color: #111827; font-size: 13px; }
    .fx-block-item small { display: block; color: #6b7280; font-size: 11.5px; line-height: 1.3; }

/* Insignias solo visibles al editar */
.rz-html-editor-content .fx-block,
.rz-html-editor-content .fx-gallery { position: relative; }

.rz-html-editor-content .fx-gallery[data-view="carousel"]::after,
.rz-html-editor-content :is(.fx-block, .fx-gallery)[data-fx-anim]::before {
    position: absolute;
    top: -10px;
    z-index: 1;
    padding: 1px 7px;
    border-radius: 999px;
    background: #4f46e5;
    color: #fff;
    font: 600 10.5px/16px system-ui, sans-serif;
    pointer-events: none;
}

.rz-html-editor-content .fx-gallery[data-view="carousel"]::after { content: "Carrusel"; right: 6px; }
.rz-html-editor-content :is(.fx-block, .fx-gallery)[data-fx-anim]::before { content: "✨ Animado"; left: 6px; background: #7c3aed; }

/* El aviso usa ::before para el icono: la insignia de animación va en ::after */
.rz-html-editor-content .fx-callout[data-fx-anim]::before { content: ""; position: absolute; top: 15px; left: 16px; padding: 0; background: var(--c); border-radius: 0; }

.rz-html-editor-content .fx-callout[data-fx-anim]::after {
    content: "✨ Animado";
    position: absolute;
    top: -10px;
    left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #7c3aed;
    color: #fff;
    font: 600 10.5px/16px system-ui, sans-serif;
}

.rz-html-editor-content a.fx-btn { cursor: pointer; }

/* Modal vista previa 3D */
.fx-3d-modal {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
}

.fx-3d-modal-card {
    position: relative;
    width: min(640px, 100%);
    padding: 14px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}

.fx-3d-modal-stage {
    display: grid;
    place-items: center;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
    background: radial-gradient(120% 120% at 50% 0%, #f8fafc 0%, #e2e8f0 100%);
}

.fx-3d-modal-loading { color: #64748b; font: 13px system-ui, sans-serif; }

.fx-3d-modal-foot {
    margin-top: 8px;
    color: #6b7280;
    font: 12px system-ui, sans-serif;
    text-align: center;
}

.fx-3d-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
