/* ============================================================
   Image Editor — Editor de imágenes reutilizable
   /assets/css/image-editor.css
   ============================================================ */

/* ── Dropzone ────────────────────────────────────────────────────────── */
.image-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.3s ease;
}
.image-dropzone.image-dropzone-compact {
  padding: 2rem;
  width: 100%;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
}
.image-dropzone:hover {
  border-color: #0284c7;
  background: #ecf9ff;
}
.image-dropzone.dragover {
  border-color: #0284c7;
  background: #e0f2fe;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.image-dropzone-icon {
  font-size: 2.5rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.image-dropzone-compact .image-dropzone-icon {
  font-size: 1.5rem;
  margin-bottom: 0;
}
.image-dropzone-text {
  color: #475569;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.image-dropzone-compact .image-dropzone-text {
  font-size: 0.8rem;
  margin-bottom: 0;
  white-space: nowrap;
}
.image-dropzone-hint {
  color: #94a3b8;
  font-size: 0.8rem;
}
.image-dropzone-compact .image-dropzone-hint {
  font-size: 0.7rem;
  display: none;
}

/* ── Image Preview Container ────────────────────────────────────────── */
.image-preview-container {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: opacity 0.3s ease;
}
.image-preview-container.active {
  opacity: 1;
  pointer-events: auto;
}
.image-preview-img {
  width: 300px;
  height: 300px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  background: #f1f5f9;
}

/* ── Image Editor Modal ──────────────────────────────────────────────── */
.image-editor-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000 !important;
  align-items: center;
  justify-content: center;
}
.image-editor-modal.active {
  display: flex !important;
}
.image-editor-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ── Editor Header ───────────────────────────────────────────────────── */
.image-editor-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.image-editor-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}
.image-editor-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.image-editor-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* ── Editor Canvas ───────────────────────────────────────────────────── */
.image-editor-canvas-container {
  padding: 1.5rem;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.image-editor-canvas {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

/* ── Editor Controls ─────────────────────────────────────────────────── */
.image-editor-controls {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
}
.image-editor-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  color: #475569;
  text-align: center;
  gap: 0.4rem;
}
.image-editor-btn:hover {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0284c7;
}
.image-editor-btn i {
  font-size: 1.2rem;
}

/* ── Rotation Buttons ────────────────────────────────────────────────── */
.image-editor-rotate-btns {
  display: flex;
  gap: 0.5rem;
}
.image-editor-rotate-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.image-editor-rotate-btn:hover {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0284c7;
}

/* ── Footer Actions ──────────────────────────────────────────────────── */
.image-editor-footer {
  padding: 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}
.image-editor-footer button {
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}
.image-editor-footer .btn-cancel {
  background: #f1f5f9;
  color: #475569;
}
.image-editor-footer .btn-cancel:hover {
  background: #e2e8f0;
}
.image-editor-footer .btn-save {
  background: #0284c7;
  color: white;
}
.image-editor-footer .btn-save:hover {
  background: #0369a1;
}

/* ── Slider Range ────────────────────────────────────────────────────── */
.image-editor-slider-group {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
}
.image-editor-slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #475569;
}
.image-editor-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
}
.image-editor-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0284c7;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.image-editor-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0284c7;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ── File Input Hidden ───────────────────────────────────────────────── */
.image-file-input {
  display: none;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .image-editor-modal-content {
    width: 95%;
  }
  .image-editor-controls {
    grid-template-columns: repeat(2, 1fr);
  }
  .image-editor-footer {
    flex-direction: column;
  }
  .image-editor-footer button {
    width: 100%;
  }
}
