/*
  image-cropper/image-cropper.css
  ==================================
  Base komponen mengikuti pola tool lain. Tambahan khusus: overlay
  dim di luar kotak crop (pakai box-shadow trick, bukan 4 div
  terpisah -- lebih ringkas), kotak crop draggable, dan 8 handle
  resize (4 sisi + 4 sudut).
*/

.mea-tool-header { margin-bottom: 32px; }

.mea-back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mea-text-muted);
  margin-bottom: 20px;
}
.mea-back-link:hover { color: var(--mea-accent-text); }

.mea-tool-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  letter-spacing: 0.02em;
  margin: 8px 0 8px;
  color: var(--mea-text-primary);
}
.mea-tool-header p {
  font-size: 14.5px;
  color: var(--mea-text-secondary);
  margin: 0;
  max-width: 55ch;
}

.mea-tool-page {
  max-width: 680px;
  padding-top: 40px;
  padding-bottom: 64px;
}

[hidden] { display: none !important; }

/* ---------- Drop zone ---------- */

.mea-drop-zone {
  border: 1px dashed var(--mea-border-strong);
  border-radius: var(--mea-radius-lg);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.mea-drop-zone:hover, .mea-drop-zone.drag-active {
  border-color: var(--mea-accent);
  background: var(--mea-accent-muted);
}
.mea-drop-zone p { margin: 0; color: var(--mea-text-secondary); font-size: 14px; }
.mea-drop-zone .dz-sub { font-size: 12px; color: var(--mea-text-muted); margin-top: 6px; }
.mea-drop-zone span { color: var(--mea-accent-text); font-weight: 600; }

/* ---------- Editor section / fields ---------- */

.mea-editor-section {
  margin-top: 24px;
  border-top: 1px solid var(--mea-border);
  padding-top: 24px;
}

.mea-field { margin-bottom: 24px; }
.mea-field > label {
  display: block;
  font-size: 13px;
  color: var(--mea-text-secondary);
  margin-bottom: 8px;
}
.mea-field-hint { margin: 8px 0 0; font-size: 12px; color: var(--mea-text-muted); }

.mea-ratio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.mea-quality-btn {
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--mea-border);
  border-radius: var(--mea-radius-sm);
  color: var(--mea-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.mea-quality-btn:hover { border-color: var(--mea-border-strong); }
.mea-quality-btn.active {
  border-color: var(--mea-accent);
  background: var(--mea-accent-muted);
  color: var(--mea-accent-text);
}

/* ---------- Crop canvas + box ---------- */

.mea-crop-canvas-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--mea-border);
  border-radius: var(--mea-radius-md);
}

.mea-crop-wrap {
  position: relative;
  margin: 0 auto;
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #1a1a1a 0% 50%) 50% / 12px 12px;
  touch-action: none;
  line-height: 0;
  /* width/height diset inline lewat JS = ukuran px asli canvas preview */
}

#mea-crop-canvas { display: block; }

.mea-crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mea-crop-box {
  position: absolute;
  border: 1.5px solid #fff;
  /* Dim area di luar kotak crop lewat box-shadow raksasa -- trik
     umum, lebih ringkas daripada 4 elemen div terpisah untuk
     top/bottom/left/right mask. */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}

.mea-crop-handle {
  position: absolute;
  background: var(--mea-accent);
  border: 1.5px solid #fff;
  pointer-events: auto;
  touch-action: none;
}

/* Handle sisi (tengah tepi) -- bar tipis */
.mea-handle-n, .mea-handle-s {
  left: 50%;
  width: 28px;
  height: 8px;
  margin-left: -14px;
  border-radius: 4px;
  cursor: ns-resize;
}
.mea-handle-n { top: -4px; }
.mea-handle-s { bottom: -4px; }

.mea-handle-e, .mea-handle-w {
  top: 50%;
  width: 8px;
  height: 28px;
  margin-top: -14px;
  border-radius: 4px;
  cursor: ew-resize;
}
.mea-handle-e { right: -4px; }
.mea-handle-w { left: -4px; }

/* Handle sudut -- kotak kecil */
.mea-crop-handle[data-handle="nw"],
.mea-crop-handle[data-handle="ne"],
.mea-crop-handle[data-handle="sw"],
.mea-crop-handle[data-handle="se"] {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.mea-handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.mea-handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.mea-handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.mea-handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }

/* ---------- Buttons / status ---------- */

.mea-btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--mea-accent);
  color: #061121;
  border: none;
  border-radius: var(--mea-radius-md);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.mea-btn-primary:hover { background: #ffffff; transform: translateY(-1px); }
.mea-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.mea-status { margin-top: 12px; font-size: 13px; min-height: 18px; }

/* ---------- Result ---------- */

.mea-result-section {
  margin-top: 24px;
  border-top: 1px solid var(--mea-border);
  padding-top: 24px;
}

.mea-result-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.mea-selected-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--mea-radius-sm);
  border: 1px solid var(--mea-border);
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #1a1a1a 0% 50%) 50% / 8px 8px;
}
.mea-selected-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mea-selected-name { font-size: 13px; color: var(--mea-text-primary); }
.mea-selected-size { font-size: 12px; color: var(--mea-text-muted); }

.mea-download-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px;
  background: var(--mea-success);
  color: #061121;
  border-radius: var(--mea-radius-md);
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.mea-download-btn:hover { transform: translateY(-1px); }

/* ---------- FAQ (SEO) ---------- */

.mea-faq { margin-top: 48px; border-top: 1px solid var(--mea-border); padding-top: 24px; }
.mea-faq h2 { font-size: 16px; font-weight: 600; margin: 0 0 16px; color: var(--mea-text-primary); }
.mea-faq-item { margin-bottom: 4px; border-bottom: 1px solid var(--mea-border); }
.mea-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--mea-text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mea-faq-item summary::-webkit-details-marker { display: none; }
.mea-faq-item p { margin: 0 4px 16px; font-size: 13.5px; color: var(--mea-text-secondary); }
