/* IMAGE-CROP-UX-A1 / REALTY-MEDIA-CROP-LIVE-QA-B1 — fixed-avatar crop editor */

.avatar-crop-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0 1rem;
  box-sizing: border-box;
}

.avatar-crop-editor__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.avatar-crop-editor__viewport {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin-inline: auto;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  touch-action: none;
  background: #1a1a1a;
  border: 2px solid currentColor;
  box-sizing: border-box;
  cursor: grab;
  outline-offset: 3px;
}

.avatar-crop-editor__viewport:focus-visible {
  outline: 3px solid var(--color-accent, #0d6efd);
}

.avatar-crop-editor__viewport:active {
  cursor: grabbing;
}

.avatar-crop-editor__image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
  will-change: transform;
}

/* Circular framing guide: dim exterior, keep square JPEG export contract. */
.avatar-crop-editor__guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  box-sizing: border-box;
  /* Soft white ring on the circle edge */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.avatar-crop-editor__instructions {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: inherit;
  opacity: 0.85;
  overflow-wrap: anywhere;
}

.avatar-crop-editor__rotate {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  max-width: 360px;
  margin-inline: auto;
}

.avatar-crop-editor__zoom {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  max-width: 360px;
  margin-inline: auto;
}

.avatar-crop-editor__zoom input[type="range"] {
  width: 100%;
}

.avatar-crop-editor__error {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-danger, #b42318);
  overflow-wrap: anywhere;
}

.avatar-crop-editor__status {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.avatar-crop-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.avatar-crop-editor__btn {
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm, 0.35rem);
  border: 1px solid transparent;
  font-family: var(--font-sans, inherit);
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold, 600);
  line-height: 1.2;
  cursor: pointer;
}

.avatar-crop-editor__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.avatar-crop-editor__btn:focus-visible {
  outline: 3px solid var(--color-accent, #0d6efd);
  outline-offset: 2px;
}

.avatar-crop-editor__btn--secondary {
  background: transparent;
  border-color: var(--color-border-default, currentColor);
  color: inherit;
}

.avatar-crop-editor__btn--primary {
  background: var(--color-accent, #0d6efd);
  border-color: var(--color-accent, #0d6efd);
  color: var(--color-text-on-brand, #fff);
}

.avatar-crop-editor__btn--primary:hover:not(:disabled) {
  background: var(--color-accent-hover, var(--color-accent, #0d6efd));
  border-color: var(--color-accent-hover, var(--color-accent, #0d6efd));
}

@media (max-width: 375px) {
  .avatar-crop-editor__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .avatar-crop-editor__btn {
    width: 100%;
  }
}

@media (max-width: 320px) {
  .avatar-crop-editor__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .avatar-crop-editor__btn {
    width: 100%;
    min-height: 2.5rem;
  }

  .avatar-crop-editor__viewport {
    max-width: 100%;
  }
}

/* CHAT-ATTACHMENT-COMPOSER-MEDIA-VIEWER-A1 — chat-local bounded editor.
   Does not change standalone property create/edit editor surfaces. */
.chat-image-editor-modal .modal-dialog,
.chat-image-editor-modal__dialog {
  width: min(720px, calc(100vw - 16px));
  max-width: min(720px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  margin: 8px auto;
}
.chat-image-editor-modal .modal-content,
.chat-image-editor-modal__content {
  max-height: calc(100dvh - 16px);
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-image-editor-modal .modal-header {
  flex: 0 0 auto;
}
.chat-image-editor-modal .modal-body,
.chat-image-editor-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.chat-image-editor-modal .modal-header .modal-btn-close {
  padding: 0;
}
.chat-image-editor-modal .modal-header .modal-btn-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(13, 110, 253, 0.45));
}
.chat-image-editor-modal .modal-header .modal-btn-close:active:not(:disabled) {
  background: var(--color-bg-subtle, rgba(0, 0, 0, 0.06));
}
.chat-image-editor-modal .modal-header .modal-btn-close:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.chat-image-editor-modal .avatar-crop-editor {
  margin: 0;
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.chat-image-editor-modal .avatar-crop-editor__viewport {
  flex: 0 0 auto;
  width: min(100%, 360px, 56dvh);
  max-width: min(100%, 360px);
  max-height: min(56dvh, 560px);
  aspect-ratio: 1 / 1;
  background: var(--color-bg-subtle, #f4f4f5);
}
.chat-image-editor-modal .avatar-crop-editor__rotate,
.chat-image-editor-modal .avatar-crop-editor__zoom,
.chat-image-editor-modal .avatar-crop-editor__instructions,
.chat-image-editor-modal .avatar-crop-editor__actions {
  flex: 0 0 auto;
  max-width: 100%;
}
.chat-image-editor-modal .avatar-crop-editor__btn--secondary:hover:not(:disabled) {
  background: var(--color-bg-hover, rgba(0, 0, 0, 0.06));
}
.chat-image-editor-modal .avatar-crop-editor__btn--secondary:active:not(:disabled) {
  background: var(--color-bg-subtle, rgba(0, 0, 0, 0.08));
}

@media (max-width: 767.98px) {
  .chat-image-editor-modal .modal-dialog,
  .chat-image-editor-modal__dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px auto;
  }
  .chat-image-editor-modal .modal-content,
  .chat-image-editor-modal__content {
    max-height: calc(100dvh - 16px);
    height: auto;
    border-radius: var(--radius-md, 12px);
  }
  .chat-image-editor-modal .modal-body,
  .chat-image-editor-modal__body {
    overflow: hidden;
  }
  .chat-image-editor-modal .avatar-crop-editor__viewport {
    width: min(100%, 360px, 48dvh);
    max-height: min(48dvh, 420px);
  }
}

/* Compact chat-only layout at 320/375/390/430-class widths.
   Does not change unscoped property create/edit editor defaults. */
@media (max-width: 430px) {
  .chat-image-editor-modal .modal-dialog,
  .chat-image-editor-modal__dialog {
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
  }
  .chat-image-editor-modal .modal-content,
  .chat-image-editor-modal__content {
    max-height: calc(100dvh - 12px);
    overflow: hidden;
  }
  .chat-image-editor-modal .modal-body,
  .chat-image-editor-modal__body {
    overflow: hidden;
    min-height: 0;
  }
  .chat-image-editor-modal .avatar-crop-editor {
    gap: 0.4rem;
  }
  .chat-image-editor-modal .avatar-crop-editor__viewport {
    width: min(100%, 28dvh, 200px);
    max-height: min(28dvh, 200px);
  }
  .chat-image-editor-modal .avatar-crop-editor__rotate {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    max-width: 100%;
  }
  .chat-image-editor-modal .avatar-crop-editor__rotate .avatar-crop-editor__btn,
  .chat-image-editor-modal .avatar-crop-editor__actions .avatar-crop-editor__btn {
    width: auto;
    max-width: 100%;
    min-height: 2rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.8rem;
  }
  .chat-image-editor-modal .avatar-crop-editor__instructions {
    font-size: 0.75rem;
    line-height: 1.25;
  }
  .chat-image-editor-modal .avatar-crop-editor__zoom {
    gap: 0.15rem;
    max-width: 100%;
  }
  .chat-image-editor-modal .avatar-crop-editor__actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.4rem;
  }
}

/* PRE-ZADRUZBU-RB3-RESIDUAL-B1 — Property create/edit editor modal
   reuses the chat editor dialog geometry via domain-neutral classes.
   Chat-owned class names above stay intact for existing tests. */
.image-editor-modal .modal-dialog,
.image-editor-modal__dialog {
  width: min(720px, calc(100vw - 16px));
  max-width: min(720px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  margin: 8px auto;
}
.image-editor-modal .modal-content,
.image-editor-modal__content {
  max-height: calc(100dvh - 16px);
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.image-editor-modal .modal-header {
  flex: 0 0 auto;
}
.image-editor-modal .modal-body,
.image-editor-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.image-editor-modal .modal-header .modal-btn-close {
  padding: 0;
}
.image-editor-modal .modal-header .modal-btn-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(13, 110, 253, 0.45));
}
.image-editor-modal .modal-header .modal-btn-close:active:not(:disabled) {
  background: var(--color-bg-subtle, rgba(0, 0, 0, 0.06));
}
.image-editor-modal .modal-header .modal-btn-close:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.image-editor-modal .avatar-crop-editor {
  margin: 0;
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.image-editor-modal .avatar-crop-editor__viewport {
  flex: 0 0 auto;
  width: min(100%, 360px, 56dvh);
  max-width: min(100%, 360px);
  max-height: min(56dvh, 560px);
  aspect-ratio: 1 / 1;
  background: var(--color-bg-subtle, #f4f4f5);
}
.image-editor-modal .avatar-crop-editor__rotate,
.image-editor-modal .avatar-crop-editor__zoom,
.image-editor-modal .avatar-crop-editor__instructions,
.image-editor-modal .avatar-crop-editor__actions {
  flex: 0 0 auto;
  max-width: 100%;
}

@media (max-width: 767.98px) {
  .image-editor-modal .modal-dialog,
  .image-editor-modal__dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px auto;
  }
  .image-editor-modal .modal-content,
  .image-editor-modal__content {
    max-height: calc(100dvh - 16px);
    height: auto;
    border-radius: var(--radius-md, 12px);
  }
  .image-editor-modal .modal-body,
  .image-editor-modal__body {
    overflow: hidden;
  }
  .image-editor-modal .avatar-crop-editor__viewport {
    width: min(100%, 360px, 48dvh);
    max-height: min(48dvh, 420px);
  }
}

@media (max-width: 430px) {
  .image-editor-modal .modal-dialog,
  .image-editor-modal__dialog {
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
  }
  .image-editor-modal .modal-content,
  .image-editor-modal__content {
    max-height: calc(100dvh - 12px);
    overflow: hidden;
  }
  .image-editor-modal .modal-body,
  .image-editor-modal__body {
    overflow: hidden;
    min-height: 0;
  }
  .image-editor-modal .avatar-crop-editor {
    gap: 0.4rem;
  }
  .image-editor-modal .avatar-crop-editor__viewport {
    width: min(100%, 28dvh, 200px);
    max-height: min(28dvh, 200px);
  }
  .image-editor-modal .avatar-crop-editor__rotate {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    max-width: 100%;
  }
  .image-editor-modal .avatar-crop-editor__rotate .avatar-crop-editor__btn,
  .image-editor-modal .avatar-crop-editor__actions .avatar-crop-editor__btn {
    width: auto;
    max-width: 100%;
    min-height: 2rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.8rem;
  }
  .image-editor-modal .avatar-crop-editor__instructions {
    font-size: 0.75rem;
    line-height: 1.25;
  }
  .image-editor-modal .avatar-crop-editor__zoom {
    gap: 0.15rem;
    max-width: 100%;
  }
  .image-editor-modal .avatar-crop-editor__actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.4rem;
  }
}
