/* ===== Модалка редактора изображений ===== */
#editorModal {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 28, 0.85);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

#editorModal.active {
    display: flex;
}

.editor-modal {
    width: 100%;
    max-width: 900px;
    max-height: calc(100dvh - 48px);
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

/* Шапка */
.editor-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.editor-modal__title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-modal__back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #6f02ff;
    padding: 0;
    line-height: 1;
}

.editor-modal__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1d2e;
    font-family: "Wix Madefor Display", sans-serif;
}

.editor-modal__subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #8b90a0;
    font-family: "Wix Madefor Display", sans-serif;
}

/* ===== Вкладки "Обрезка" / "Фильтры" ===== */
.editor-modal__tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f3f4f8;
    border-radius: 12px;
    flex-shrink: 0;
    align-self: flex-start;
}

.editor-modal__tab {
    height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #8b90a0;
    font-size: 13px;
    font-weight: 600;
    font-family: "Wix Madefor Display", sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.editor-modal__tab--active {
    background: #fff;
    color: #1a1d2e;
    box-shadow: 0 2px 6px rgba(26, 29, 46, 0.1);
}

/* Шаги (вкладки) */
.editor-modal__step {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    min-height: 0;
}

.editor-modal__step--hidden {
    display: none;
}

/* ===== Контейнер с картинкой (crop) ===== */
.editor-modal__canvas {
    flex: 1;
    min-height: 300px;
    max-height: 60vh;
    background: #f3f4f8;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.editor-modal__canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== Превью фильтров (большой canvas) ===== */
.editor-modal__filter-preview {
    flex: 1;
    min-height: 300px;
    max-height: 50vh;
    background: #f3f4f8;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
}

.editor-modal__filter-preview canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
}

/* ===== Полоса фильтров (горизонтальный скролл) ===== */
.editor-modal__filter-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: #c5b8e8 transparent;
}

.editor-modal__filter-strip::-webkit-scrollbar {
    height: 6px;
}

.editor-modal__filter-strip::-webkit-scrollbar-thumb {
    background: #c5b8e8;
    border-radius: 3px;
}

.editor-modal__filter-strip::-webkit-scrollbar-track {
    background: transparent;
}

.editor-filter-item {
    flex-shrink: 0;
    width: 88px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: "Wix Madefor Display", sans-serif;
}

.editor-filter-item__img {
    width: 84px;
    height: 84px;
    border-radius: 12px;
    overflow: hidden;
    background: #e5e7eb;
    border: 2px solid transparent;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.editor-filter-item:hover .editor-filter-item__img {
    transform: translateY(-2px);
}

.editor-filter-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.editor-filter-item__name {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.15s ease;
}

.editor-filter-item--active .editor-filter-item__img {
    border-color: #6f02ff;
}

.editor-filter-item--active .editor-filter-item__name {
    color: #6f02ff;
}

/* ===== Слайдер интенсивности фильтра ===== */
.editor-modal__intensity {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.editor-modal__intensity--hidden {
    display: none;
}

.editor-modal__intensity-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    font-family: "Wix Madefor Display", sans-serif;
    white-space: nowrap;
}

/* ===== Панель управления (в crop-шаге) ===== */
.editor-modal__controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.editor-modal__zoom {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.editor-modal__zoom-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    font-family: "Wix Madefor Display", sans-serif;
    white-space: nowrap;
}

/* Общий стиль для обоих слайдеров (zoom + intensity) */
.editor-modal__zoom-slider,
.editor-modal__intensity-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    cursor: pointer;
}

.editor-modal__zoom-slider::-webkit-slider-thumb,
.editor-modal__intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6f02ff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(111, 2, 255, 0.4);
    transition: transform 0.15s ease;
}

.editor-modal__zoom-slider::-webkit-slider-thumb:hover,
.editor-modal__intensity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.editor-modal__zoom-slider::-moz-range-thumb,
.editor-modal__intensity-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6f02ff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(111, 2, 255, 0.4);
}

.editor-modal__reset {
    background: #f3f4f8;
    border: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    font-family: "Wix Madefor Display", sans-serif;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.editor-modal__reset:hover {
    background: #e5e7eb;
    color: #1a1d2e;
}

/* Кнопки действий */
.editor-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.editor-modal__btn {
    height: 48px;
    padding: 0 24px;
    border-radius: 14px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    font-family: "Wix Madefor Display", sans-serif;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.editor-modal__btn--cancel {
    background: #f3f4f8;
    color: #4b5563;
}

.editor-modal__btn--cancel:hover {
    background: #e5e7eb;
}

.editor-modal__btn--apply {
    background: linear-gradient(88.98deg, #6f02ff 43.24%, #9442ff 99.13%);
    color: #fff;
    min-width: 140px;
}

.editor-modal__btn--apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(111, 2, 255, 0.3);
}

.editor-modal__hint {
    margin: 0;
    font-size: 12px;
    color: #9ea3b0;
    font-family: "Wix Madefor Display", sans-serif;
    text-align: center;
}

/* Мобильный вид */
@media (max-width: 720px) {
    #editorModal {
        padding: max(12px, env(safe-area-inset-top, 12px))
                 max(12px, env(safe-area-inset-right, 12px))
                 max(12px, env(safe-area-inset-bottom, 12px))
                 max(12px, env(safe-area-inset-left, 12px));
    }

    .editor-modal {
        padding: 16px;
        gap: 14px;
        max-height: calc(100dvh - 24px);
    }

    .editor-modal__title {
        font-size: 17px;
    }

    .editor-modal__canvas,
    .editor-modal__filter-preview {
        max-height: 45vh;
    }

    .editor-modal__controls {
        gap: 10px;
    }

    .editor-modal__actions {
        flex-direction: column-reverse;
    }

    .editor-modal__btn {
        width: 100%;
    }

    .editor-filter-item {
        width: 76px;
    }

    .editor-filter-item__img {
        width: 72px;
        height: 72px;
    }
}

/* Кнопка "Редактировать" в карточке фото */
.photo-item__edit {
    background: #f3f4f8;
    border: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    font-family: "Wix Madefor Display", sans-serif;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.photo-item__edit:hover {
    background: #6f02ff;
    color: #fff;
}