/* ============================================================
   AXIOMA · Recorte asistido de la evidencia fotográfica (Nivel 0)
   Visor a pantalla completa construido desde JS (js/image-crop.js).
   Solo tokens AXIOMA: no se hardcodean colores de marca.
   Mobile-first: el flujo de captura de lecturas es de campo.
   ============================================================ */

.ax-crop {
    position: fixed;
    inset: 0;
    z-index: 9998; /* capa de herramienta de app; el command palette usa 9999 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--ax-gray-950) 72%, transparent);
    overscroll-behavior: contain;
}

.ax-crop-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 760px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 14px;
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-lg);
    background: var(--ax-surface);
    box-shadow: var(--ax-shadow-panel);
}

.ax-crop-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ax-crop-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ax-text-primary);
}

.ax-crop-hint {
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--ax-text-secondary);
}

.ax-crop-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--ax-radius-md);
    background: var(--ax-gray-900);
    /* Sin esto el dedo hace scroll de la página en vez de arrastrar el recuadro. */
    touch-action: none;
}

.ax-crop-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    /* Los gestos los captura el escenario; la imagen no participa. */
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.ax-crop-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid var(--ax-primary);
    border-radius: var(--ax-radius-sm);
    /* El scrim del exterior: un solo elemento en vez de cuatro capas. */
    box-shadow: 0 0 0 9999px color-mix(in srgb, var(--ax-gray-950) 62%, transparent);
    cursor: move;
    touch-action: none;
}

.ax-crop-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--ax-surface);
    border-radius: var(--ax-radius-full);
    background: var(--ax-primary);
    box-shadow: var(--ax-shadow-sm);
    touch-action: none;
}

.ax-crop-handle.nw { top: -12px; left: -12px; cursor: nwse-resize; }
.ax-crop-handle.ne { top: -12px; right: -12px; cursor: nesw-resize; }
.ax-crop-handle.sw { bottom: -12px; left: -12px; cursor: nesw-resize; }
.ax-crop-handle.se { bottom: -12px; right: -12px; cursor: nwse-resize; }

.ax-crop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ax-crop-btn {
    flex: 1 1 140px;
    min-height: 46px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: var(--ax-radius);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.ax-crop-btn.primary {
    background: var(--ax-primary);
    color: var(--ax-primary-contrast);
    box-shadow: var(--ax-shadow-primary-sm);
}

.ax-crop-btn.primary:active {
    background: var(--ax-primary-hover);
}

.ax-crop-btn.ghost {
    background: var(--ax-surface);
    border-color: var(--ax-border);
    color: var(--ax-text-secondary);
}

.ax-crop-btn:focus-visible {
    outline: none;
    box-shadow: var(--ax-shadow-focus);
}

@media (min-width: 961px) {
    .ax-crop-actions {
        justify-content: flex-end;
    }

    .ax-crop-btn {
        flex: 0 0 auto;
        min-width: 160px;
    }
}
