/* Editor de foto de perfil (crop 4:5 + giro + compresión) */

body.hf-photo-editor-open {
  overflow: hidden;
}

.hf-photo-editor {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

.hf-photo-editor__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.hf-photo-editor__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(92dvh, 720px);
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid #3c3c3c;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.hf-photo-editor__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.hf-photo-editor__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.hf-photo-editor__icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #6f6f6f;
  background: #2c2c2c;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hf-photo-editor__icon-btn:hover {
  border-color: #88f047;
  color: #88f047;
}

.hf-photo-editor__hint {
  flex-shrink: 0;
  margin: 0;
  padding: 0 16px 10px;
  color: #b8b8b8;
  font-size: 0.82rem;
  line-height: 1.4;
}

.hf-photo-editor__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.hf-photo-editor__stage {
  padding: 0 16px;
  display: flex;
  justify-content: center;
}

.hf-photo-editor__frame {
  width: min(240px, 68vw);
  max-height: min(300px, 42dvh);
  aspect-ratio: 4 / 5;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 2px solid #88f047;
  background: #0f0f0f;
  touch-action: none;
  user-select: none;
}

.hf-photo-editor__frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.hf-photo-editor__frame canvas:active {
  cursor: grabbing;
}

.hf-photo-editor__tools {
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hf-photo-editor__zoom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #b8b8b8;
  font-size: 0.78rem;
  font-weight: 600;
}

.hf-photo-editor__zoom input[type='range'] {
  width: 100%;
  accent-color: #88f047;
}

.hf-photo-editor__rotate {
  display: flex;
  gap: 8px;
}

.hf-photo-editor__tool-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #6f6f6f;
  background: #2c2c2c;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.hf-photo-editor__tool-btn:hover {
  border-color: #88f047;
  color: #88f047;
}

.hf-photo-editor__foot {
  flex-shrink: 0;
  display: flex !important;
  gap: 8px;
  justify-content: stretch;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #3c3c3c;
  background: #1a1a1a;
  visibility: visible !important;
  opacity: 1 !important;
}

.hf-photo-editor__btn {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}

.hf-photo-editor__btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.hf-photo-editor__btn--ghost {
  flex: 0 0 auto;
  background: transparent;
  border-color: #6f6f6f;
  color: #fff;
}

.hf-photo-editor__btn--ghost:hover {
  border-color: #b8b8b8;
}

.hf-photo-editor__btn--primary {
  flex: 1 1 auto;
  background: #88f047;
  color: #0f0f0f;
  border-color: #88f047;
}

.hf-photo-editor__btn--primary:hover {
  filter: brightness(1.05);
}

@media (max-height: 700px) {
  .hf-photo-editor__frame {
    width: min(200px, 58vw);
    max-height: min(250px, 36dvh);
  }

  .hf-photo-editor__hint {
    padding-bottom: 6px;
    font-size: 0.78rem;
  }

  .hf-photo-editor__tools {
    padding-top: 8px;
  }
}
