/*
 * iris-crop.css — круглый кроппер радужки с автопоиском (js/iris-crop.js).
 * Один на всю экосистему: запросы исходников (/upload), Macrolib, расшифровка (/scan).
 * Поп-ап — канон .qr-pop брендбука, поле — .f-input, кнопки — .orange_butt и нейтральная .btn--ghost.
 * Подключение — ml_iris_crop_assets() (inc/iris-crop.php).
 */

/* ------------------------------------------------------------ поп-ап (канон .qr-pop) */
.ml-icrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
    overflow-y: auto;
    background: rgba(20, 20, 20, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    font-family: "montserrat", sans-serif;
}
.ml-icrop.active { opacity: 1; visibility: visible; pointer-events: auto; }
.ml-icrop__win {
    position: relative;
    width: min(900px, 100%);
    margin: auto;
    padding: 28px;
    box-sizing: border-box;
    border-radius: 30px;
    background: #1d1d1d;
    color: #fff;
    text-align: left;
    transform: scale(0.8) translateY(30px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.ml-icrop.active .ml-icrop__win { transform: none; opacity: 1; }
.ml-icrop__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #2A2A2A;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: color 0.25s ease;
}
.ml-icrop__close:hover, .ml-icrop__close:active { color: var(--orange); }
.ml-icrop__title { margin: 0 48px 12px 0; font-family: "montserrat", sans-serif; font-size: 22px; line-height: 1.3; font-weight: 400; color: #fff; }
.ml-icrop__hint { margin: 0 0 24px; font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, 0.7); }

/* ------------------------------------------------------------ сцена */
.ml-icrop__stage {
    position: relative;
    height: 58vh;
    min-height: 320px;
    margin-bottom: 20px;
    border-radius: 15px;
    background: #111111;
    overflow: hidden;
    touch-action: none;
}
.ml-icrop__canvas { position: absolute; inset: 0; display: block; }
.ml-icrop__marker {
    position: absolute;
    border: 1px solid var(--orange); /* тонкое кольцо: граница кропа видна точно */
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(20, 20, 20, 0.6);
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    pointer-events: none;
}
.ml-icrop__cands { position: absolute; inset: 0; pointer-events: none; }
.ml-icrop__cand {
    position: absolute;
    padding: 0;
    border: 1px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: none;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    cursor: pointer;
    pointer-events: auto;
    z-index: 1;
    transition: border-color 0.25s ease;
}
.ml-icrop__cand:hover { border-color: var(--orange); }
.ml-icrop__cand.is-active { opacity: 0; pointer-events: none; }

/* поиск радужки: снимок притушен (как вне круга кропа), вращается тонкое кольцо; круг можно тянуть сразу */
.ml-icrop__loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(20, 20, 20, 0.6);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.ml-icrop__loading.is-on { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
.ml-icrop__scan {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--orange);
    box-sizing: border-box;
    animation: ml-icrop-spin 0.9s linear infinite;
}
.ml-icrop__scan::after { /* «зрачок» дышит в центре */
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    animation: ml-icrop-breath 1.8s ease-in-out infinite;
}
@keyframes ml-icrop-spin { to { transform: rotate(360deg); } }
@keyframes ml-icrop-breath { 0%, 100% { transform: scale(0.6); } 50% { transform: scale(1); } }
.ml-icrop__loading:not(.is-on) .ml-icrop__scan,
.ml-icrop__loading:not(.is-on) .ml-icrop__scan::after { animation-play-state: paused; }

/* «радужка не найдена» — тихая плашка внизу сцены, сама гаснет */
.ml-icrop__msg {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    width: max-content;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    box-sizing: border-box;
    padding: 10px 18px;
    border-radius: 100px;
    background: #2A2A2A;
    color: #fff;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 2;
}
.ml-icrop__msg.is-on { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------ размер круга */
.ml-icrop__slider {
    display: block;
    width: 100%;
    height: 6px;
    margin: 0 0 20px;
    border-radius: 3px;
    background: #2A2A2A;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.ml-icrop__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: background-color 0.25s ease;
}
.ml-icrop__slider::-webkit-slider-thumb:hover { background: var(--orange); }
.ml-icrop__slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

/* ------------------------------------------------------------ комментарий (канон .f-input) */
.ml-icrop__note {
    display: block;
    width: 100%;
    min-height: 72px;
    margin: 0 0 20px;
    box-sizing: border-box;
    border: none;
    border-radius: 20px;
    padding: 14px 20px;
    background: var(--glass_background);
    -webkit-backdrop-filter: var(--blur_background);
    backdrop-filter: var(--blur_background);
    color: #fff;
    font-family: "montserrat", sans-serif;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: background-color 0.25s ease;
}
.ml-icrop__note::placeholder { color: rgba(255, 255, 255, 0.4); }
.ml-icrop__note:focus { background: var(--glass_background_brighter); }
.ml-icrop__note[hidden] { display: none; }

/* ------------------------------------------------------------ кнопки */
.ml-icrop__btns { display: flex; gap: 12px; justify-content: flex-end; }
.ml-icrop__btns button { flex: 0 1 240px; min-height: 52px; font-size: 16px; padding: 0 16px; margin: 0; }
.ml-icrop__btns button:disabled { opacity: 0.45; pointer-events: none; }
.ml-icrop__cancel { /* нейтральная (канон .btn--ghost) */
    border: 1.5px solid #2A2A2A;
    border-radius: 100px;
    background: #2A2A2A;
    color: #fff;
    font-family: "montserrat", sans-serif;
    cursor: pointer;
    transition: color 0.25s ease;
}
.ml-icrop__cancel:hover, .ml-icrop__cancel:active { color: var(--orange); }

@media (max-width: 769px) {
    /* на телефоне — на весь экран без скруглений */
    .ml-icrop { padding: 0; }
    .ml-icrop__win { width: 100%; min-height: 100%; border-radius: 0; padding: 64px 16px 20px; }
    .ml-icrop__stage { height: 50vh; min-height: 260px; }
    .ml-icrop__btns { flex-direction: column-reverse; }
    .ml-icrop__btns button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .ml-icrop, .ml-icrop__win { transition: none; }
}
