/**
 * STRELA — админский фоторедактор (аренда + магазин). Mobile-first.
 * Используется js/strela-photo-editor.js (window.StrelaPhotoEditor).
 */

.spe[hidden] { display: none !important; }

.spe {
    position: fixed;
    inset: 0;
    z-index: 100900;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #0b1220;
    color: #f8fafc;
    /* Android/iOS: учитываем вырезы и жестовую навигацию по всем краям. */
    padding:
        env(safe-area-inset-top, 0px)
        env(safe-area-inset-right, 0px)
        env(safe-area-inset-bottom, 0px)
        env(safe-area-inset-left, 0px);
    overscroll-behavior: contain;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.spe__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .04);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.spe__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spe__save {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: #f3bf00;
    color: #16181d;
    font: inherit;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

.spe__save:active { transform: scale(.97); }

.spe__close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.spe__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
}

.spe__img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    touch-action: pinch-zoom;
}

.spe__crop {
    position: absolute;
    inset: 10px;
    display: block;
    overflow: hidden;
    border-radius: 12px;
}

.spe__crop[hidden] { display: none !important; }

.spe__cropimg {
    display: block;
    max-width: 100%;
}

/* Крупные, удобные для пальца маркеры Cropper.js */
.spe__crop .cropper-point {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50%;
    background-color: #f3bf00;
    opacity: 1;
}
.spe__crop .cropper-point.point-n,
.spe__crop .cropper-point.point-s,
.spe__crop .cropper-point.point-e,
.spe__crop .cropper-point.point-w { display: none !important; }

.spe__crop .cropper-line { background-color: rgba(243, 191, 0, .5); }

.spe__crop .cropper-view-box {
    outline: 2px solid #f3bf00;
    outline-color: #f3bf00;
}

.spe__crop .cropper-face { background-color: transparent; }
.spe__crop .cropper-modal { background-color: #000; opacity: .62; }
.spe__crop .cropper-dashed { border-color: rgba(255, 255, 255, .45); }

.spe__bar,
.spe__cropbar {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .05);
    border-top: 1px solid rgba(255, 255, 255, .08);
    overflow-x: auto;
    scrollbar-width: none;
}
.spe__bar[hidden],
.spe__cropbar[hidden] { display: none !important; }
.spe__bar::-webkit-scrollbar,
.spe__cropbar::-webkit-scrollbar { display: none; }

/* Кадрирование: два ряда, «Готово» — крупная кнопка под большим пальцем */
.spe__cropbar {
    flex-direction: column;
    gap: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
}
.spe__croprow {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.spe__croprow .spe__btn { flex: 1 1 0; min-width: 0; }

.spe__btn {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
    color: #f8fafc;
    font: inherit;
    font-weight: 650;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}
.spe__btn:active { transform: scale(.97); }
.spe__btn--icon { flex: 0 0 auto; width: 48px; padding: 0; font-size: 16px; }
.spe__btn--accent { background: #f3bf00; color: #16181d; font-weight: 800; }
.spe__btn--ghost { background: rgba(255, 255, 255, .06); }
.spe__btn--wide { flex: 2 1 0 !important; }
.spe__croprow .spe__btn--icon { flex: 0 0 48px !important; }

.spe__panel {
    flex: 0 0 auto;
    max-height: 42dvh;
    overflow-y: auto;
    padding: 12px;
    background: rgba(255, 255, 255, .06);
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.spe__panel[hidden] { display: none !important; }

.spe__prow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.spe__chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 11px;
    background: rgba(255, 255, 255, .06);
    color: #f8fafc;
    font: inherit;
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;
}
.spe__chip.is-on { border-color: #f3bf00; background: rgba(243, 191, 0, .18); color: #ffe28a; }

.spe__chip--wide {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 14px;
    text-align: left;
}
.spe__chip--wide b { font-size: 14px; }
.spe__chip--wide span { font-size: 12px; opacity: .82; font-weight: 500; }
.spe__chip--wide em { font-style: normal; color: #ffe28a; font-weight: 750; }

.spe__wait { padding: 12px; color: rgba(248, 250, 252, .7); font-size: 13px; }
.spe__pnote { margin: 4px 2px 0; font-size: 12px; color: rgba(248, 250, 252, .62); }

.spe__toast {
    position: absolute;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom, 0));
    transform: translateX(-50%) translateY(8px);
    max-width: 88vw;
    padding: 9px 16px;
    border-radius: 11px;
    background: rgba(15, 23, 42, .94);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.spe__toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

.spe.is-busy { pointer-events: none; }
.spe.is-busy .spe__stage { opacity: .6; }

@media (min-width: 720px) {
    .spe__bar, .spe__cropbar { justify-content: center; }
    .spe__btn { flex: 0 0 auto; }
}
