/* =========================================================
   Image Crop Tool — scoped styles
   Every selector is nested under .ict-scope so nothing here
   can leak into the theme, and theme resets can't easily
   leak into it either (box-sizing / font are re-asserted).
   ========================================================= */

.ict-scope {
  --ict-blue: #1E73BE;
  --ict-blue-dark: #175a94;
  --ict-border: #e2e4ea;
  --ict-text: #1c1e26;
  --ict-text-muted: #6b7280;
  --ict-bg: #ffffff;
  --ict-bg-soft: #fafafb;
  --ict-radius: 10px;
  --ict-error: #e0433d;

  all: initial;
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ict-text);
  box-sizing: border-box;
  max-width: 1100px;
  margin: 0 auto;
}

.ict-scope *,
.ict-scope *::before,
.ict-scope *::after {
  box-sizing: border-box;
  font-family: inherit;
}

.ict-scope img {
  max-width: 100%;
  display: block;
}

.ict-app {
  background: var(--ict-bg);
  border: 1px solid var(--ict-border);
  border-radius: var(--ict-radius);
  overflow: hidden;
}

/* ---------- Step: Upload ---------- */

.ict-step-upload {
  padding: 48px 24px;
}

.ict-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed var(--ict-border);
  border-radius: var(--ict-radius);
  padding: 56px 24px;
  cursor: pointer;
  color: var(--ict-text-muted);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ict-dropzone:hover,
.ict-dropzone.ict-dragover {
  border-color: var(--ict-blue);
  background: #eaf3fb;
}

.ict-upload-icon {
  color: var(--ict-blue);
}

.ict-dropzone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ict-text);
}

.ict-dropzone-sub {
  font-size: 13px;
}

.ict-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fdeceb;
  color: var(--ict-error);
  font-size: 13px;
}

.ict-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--ict-text-muted);
  cursor: pointer;
}

.ict-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ict-blue);
  cursor: pointer;
}

.ict-bulk-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--ict-blue-dark);
  background: #eaf3fb;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 4px 0;
}

/* ---------- Step: Crop ---------- */

.ict-crop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 520px;
}

@media (max-width: 780px) {
  .ict-crop-layout {
    grid-template-columns: 1fr;
  }
}

.ict-sidebar {
  border-right: 1px solid var(--ict-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 780px) {
  .ict-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--ict-border);
  }
}

.ict-heading {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.ict-heading-space {
  margin-top: 10px;
}

.ict-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ict-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ict-field label {
  font-size: 13px;
  color: var(--ict-text-muted);
}

.ict-field input,
.ict-field select,
.ict-scope select#ict-aspect {
  border: 1px solid var(--ict-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ict-text);
  background: var(--ict-bg);
  width: 100%;
}

.ict-field input:focus,
.ict-scope select:focus {
  outline: none;
  border-color: var(--ict-blue);
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.2);
}

.ict-field select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ict-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.ict-btn-primary {
  background: var(--ict-blue);
  color: #fff;
}

.ict-btn-primary:hover {
  background: var(--ict-blue-dark);
}

.ict-btn-outline {
  background: var(--ict-bg);
  border-color: var(--ict-border);
  color: var(--ict-text);
}

.ict-btn-outline:hover {
  border-color: var(--ict-blue);
  color: var(--ict-blue-dark);
}

.ict-btn-ghost {
  background: transparent;
  color: var(--ict-text-muted);
  font-weight: 500;
  padding: 8px 16px;
}

.ict-btn-ghost:hover {
  color: var(--ict-text);
  text-decoration: underline;
}

.ict-btn-crop {
  margin-top: auto;
}

.ict-arrow {
  font-weight: 700;
}

.ict-canvas-wrap {
  background: var(--ict-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 400px;
}

.ict-image-container {
  max-width: 100%;
  max-height: 70vh;
}

.ict-image-container img {
  display: block;
  max-width: 100%;
}

/* Cropper.js view boxes / handles keep their own default look;
   we only nudge the guide colour to match our accent. */
.ict-scope .cropper-view-box,
.ict-scope .cropper-face {
  outline-color: var(--ict-blue);
}
.ict-scope .cropper-line,
.ict-scope .cropper-point {
  background-color: var(--ict-blue);
}

/* Circular crop preview: rounds the live crop box so it matches the
   circular output produced when Crop Shape = Circle. border-radius
   clips the view-box (which has overflow:hidden); clip-path is added
   as a belt-and-braces fallback so the preview image itself is also
   visibly round, not just its container. */
.ict-app[data-shape="circle"] .cropper-view-box {
  border-radius: 50%;
  overflow: hidden;
}
.ict-app[data-shape="circle"] .cropper-view-box img {
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}
.ict-app[data-shape="circle"] .cropper-face {
  border-radius: 50%;
}

/* ---------- Step: Result ---------- */

.ict-step-result {
  padding: 32px 24px;
  text-align: center;
}

.ict-result-preview {
  background: var(--ict-bg-soft);
  border: 1px solid var(--ict-border);
  border-radius: var(--ict-radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 60vh;
  overflow: auto;
  margin: 16px 0;
}

.ict-result-preview img {
  max-height: 55vh;
}

.ict-result-meta {
  font-size: 13px;
  color: var(--ict-text-muted);
  margin-bottom: 18px;
}

.ict-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.ict-result-actions .ict-btn {
  width: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.ict-spin {
  animation: ict-spin 0.8s linear infinite;
}

@keyframes ict-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Step: Bulk Result ---------- */

.ict-step-bulk-result {
  padding: 32px 24px;
  text-align: center;
}

.ict-bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.ict-bulk-item {
  border: 1px solid var(--ict-border);
  border-radius: var(--ict-radius);
  background: var(--ict-bg-soft);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ict-bulk-item img {
  max-height: 110px;
  max-width: 100%;
  border-radius: 6px;
}

.ict-bulk-item-name {
  font-size: 12px;
  color: var(--ict-text-muted);
  word-break: break-all;
  text-align: center;
}

.ict-bulk-item-dl {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
}
