

.image-editor-modal,
.image-editor-modal * {
  box-sizing: border-box;
}



.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.image-editor-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transition: opacity 0.22s ease, visibility 0s linear 0s;
}



.image-editor-modal__backdrop {
  position: absolute;
  inset: 0;

  background: rgba(0, 0, 0, 0.55);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}



.image-editor-modal__dialog {
  position: relative;
  z-index: 1;

  width: min(1200px, calc(100vw - 32px));
  height: min(800px, calc(100vh - 32px));

  overflow: hidden;

  background: #f5f5f5;

  border-radius: 8px;

  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);

  display: flex;
  flex-direction: column;

  opacity: 0;

  transform: translateY(12px) scale(0.97);

  transition: opacity 0.22s ease, transform 0.22s ease;
}

.image-editor-modal.is-open .image-editor-modal__dialog {
  opacity: 1;

  transform: translateY(0) scale(1);
}



.image-editor__header {
  flex: 0 0 auto;

  height: 42px;

  padding: 0 10px 0 14px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  background: #fff;

  border-bottom: 1px solid #ddd;
}

.image-editor__file-name {
  min-width: 0;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  font-size: 14px;

  color: #333;
}



.image-editor-modal__close {
  flex: 0 0 auto;

  width: 30px;
  height: 30px;

  padding: 0;

  border: 1px solid #ccc;

  border-radius: 50%;

  background: #000;

  color: #fff;

  cursor: pointer;

  font-size: 22px;

  line-height: 27px;

  text-align: center;
  transition: all 0.2s ease;
}

.image-editor-modal__close:hover {
  background: #f0f0f0;
  color: #000;
}



.image-editor {
  width: 100%;

  flex: 1 1 auto;

  min-height: 0;

  display: flex;

  flex-direction: column;

  font-family: Arial, sans-serif;

  background: #f5f5f5;

  color: #222;
}



.image-editor__toolbar {
  flex: 0 0 auto;

  padding: 12px;

  background: #fff;

  border-bottom: 1px solid #ddd;
}



.image-editor .image-editor__reset {
  padding: 7px 14px;

  border: 1px solid #ccc;

  border-radius: 5px;

  background: #fff;

  color: #333;

  cursor: pointer;

  font-size: 14px;
}

.image-editor .image-editor__reset:hover {
  background: #f0f0f0;
}



.image-editor .image-editor__save {
  padding: 7px 16px;

  border: 1px solid #222;

  border-radius: 5px;

  background: #222;

  color: #fff;

  cursor: pointer;

  font-size: 14px;

  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.image-editor .image-editor__save:hover {
  border: 1px solid #000;

  background-color: #fff;

  color: #000;
}



.image-editor__toolbar-row {
  width: 100%;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 10px;
}

.image-editor__toolbar-left,
.image-editor__toolbar-right {
  display: flex;

  align-items: center;

  gap: 8px;
}

.image-editor__toolbar-right {
  margin-left: auto;
}



.image-editor button {
  padding: 7px 12px;

  border: 1px solid #ccc;

  border-radius: 5px;

  background: #fff;

  color: #222;

  cursor: pointer;

  font-size: 14px;
}

.image-editor button:hover {
  background: #f0f0f0;
}

.image-editor button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}



.image-editor__resize-panel {
  display: none;

  align-items: center;

  gap: 8px;

  margin-top: 8px;

  padding-top: 8px;

  border-top: 1px solid #eee;
}

.image-editor__resize-panel.is-open {
  display: flex;
}

.image-editor__resize-panel label {
  display: flex;

  align-items: center;

  gap: 4px;

  font-size: 14px;
}

.image-editor__resize-panel input[type="number"] {
  width: 80px;

  padding: 6px 8px;

  border: 1px solid #ccc;

  border-radius: 5px;

  background: #fff;

  font-size: 14px;
}

.image-editor__keep-ratio {
  margin: 0;
}

.image-editor .image-editor__apply-resize {
  background-color: #007aff;
  color: #fff;
  transition: all 0.2s ease;
}

.image-editor .image-editor__apply-resize:hover {
  background-color: #fff;
  color: #007aff;
}

.image-editor .image-editor__confirm-crop {
  background-color: #007aff;
  color: #fff;
  transition: all 0.2s ease;
}
.image-editor .image-editor__confirm-crop:hover {
  background-color: #fff;
  color: #007aff;
}

.image-editor__rotate-panel button {
    background-color: #007aff;
  color: #fff;
  transition: all 0.2s ease;
}

.image-editor__rotate-panel button:hover {
  background-color: #fff;
  color: #007aff;
}



.image-editor__rotate-panel {
  display: none;

  align-items: center;

  gap: 8px;

  margin-top: 8px;

  padding-top: 8px;

  border-top: 1px solid #eee;
}

.image-editor__rotate-panel.is-open {
  display: flex;
}



.image-editor__crop-confirm {
  display: none;

  flex: 0 0 auto;

  align-items: center;

  justify-content: flex-start;

  gap: 10px;

  padding: 8px 12px;

  background: #fff;

  border-bottom: 1px solid #ddd;

  font-size: 14px;

  color: #555;
}

.image-editor__crop-confirm button {
  padding: 6px 12px;
}



.image-editor__editor {
  flex: 1 1 auto;

  min-height: 0;

  padding: 20px;

  display: flex;

  flex-direction: column;
}



.image-editor__zoom-control {
  flex: 0 0 auto;

  width: 320px;

  max-width: 100%;

  margin: 0 auto 10px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 10px;
}

.image-editor__zoom-control button {
  width: 32px;
  height: 22px;

  padding: 0;

  font-size: 18px;

  line-height: 1;
}

.image-editor__zoom-slider {
  width: 220px;
}

.image-editor__zoom-value {
  width: 50px;

  text-align: center;

  font-size: 14px;

  color: #555;
}



.image-editor__container {
  position: relative;

  width: 800px;

  max-width: 100%;

  flex: 1 1 auto;

  min-height: 0;

  margin: auto;

  overflow: hidden;

  border: 1px solid #aaa;

  background-color: #eee;

  background-image: linear-gradient(45deg, #bdbdbd 25%, transparent 25%),
    linear-gradient(-45deg, #bdbdbd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #bdbdbd 75%),
    linear-gradient(-45deg, transparent 75%, #bdbdbd 75%);

  background-size: 20px 20px;

  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}



.image-editor__image-info {
  position: absolute;

  top: 10px;

  right: 10px;

  z-index: 10;

  display: flex;

  flex-direction: row;

  gap: 1px;

  padding: 6px 9px;

  border-radius: 5px;

  background: rgba(0, 0, 0, 0.65);

  color: #fff;

  font-size: 12px;

  line-height: 1.5;

  white-space: nowrap;

  pointer-events: none;

  user-select: none;
}

.image-editor__image-info-w {
  margin-right: 8px;
}



@media (max-width: 600px) {
  .image-editor-modal {
    padding: 0;
  }

  .image-editor-modal__dialog {
    width: 100vw;

    height: 100vh;

    max-width: none;

    max-height: none;

    border-radius: 0;
  }

  .image-editor__header {
    height: 42px;

    padding: 0 10px 0 12px;
  }

  .image-editor__toolbar {
    padding: 10px;
  }

  .image-editor__toolbar-row {
    gap: 6px;
  }

  .image-editor__toolbar-left,
  .image-editor__toolbar-right {
    gap: 6px;
  }

  .image-editor__toolbar-left button,
  .image-editor__toolbar-right button {
    padding: 6px 9px;

    font-size: 13px;
  }

  .image-editor__toolbar-right {
    margin-left: auto;
  }

  .image-editor__resize-panel,
  .image-editor__rotate-panel {
    flex-wrap: wrap;

    gap: 6px;
  }

  .image-editor__editor {
    padding: 12px;
  }

  .image-editor__container {
    width: 100%;

    max-width: none;

    min-height: 0;

    touch-action: none;
  }

  .image-editor__zoom-control {
    width: 100%;

    margin-bottom: 8px;
  }

  .image-editor__zoom-slider {
    flex: 1;

    width: auto;

    max-width: 220px;
  }

  .image-editor__image-info {
    top: 8px;

    right: 8px;

    font-size: 11px;

    padding: 5px 7px;
  }
}

.image-editor__reset.is-disabled,
.image-editor__save.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}
