:root { }

.icr-card { padding: 28px; }
.icr-title-bar { background: linear-gradient(135deg, var(--site-dark) 0%, var(--site-dark-2) 100%); border-radius: 10px 10px 0 0; padding: 18px 24px; margin: -28px -28px 24px; }
.icr-title-bar h1 { color: #fff; margin: 0; font-size: 1.4em; text-align: center; }

/* ===== Dropzone ===== */
.icr-dropzone { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 36px 20px; text-align: center; color: #6b7280; cursor: pointer; transition: all .15s ease; }
.icr-dropzone.dragover { border-color: var(--site-light); background: #f0fdfa; }
.icr-dropzone i { font-size: 2.3em; margin-bottom: 10px; display: block; color: #0d9488; }
.icr-dropzone p { margin: 0 0 4px; font-weight: 600; color: #374151; }
.icr-dropzone .icr-hint { font-size: .82em; color: #9ca3af; }
.icr-dropzone input[type="file"] { display: none; }

.icr-hint { font-size: .82em; color: #9ca3af; margin: 8px 0 0; }

.icr-error { color: var(--site-danger); background: var(--site-danger-bg); border: 1px solid var(--site-danger-border); border-radius: 8px; padding: 12px 16px; font-size: .9em; margin: 16px 0 0; }
.icr-error.hide { display: none; }

/* ===== Workspace ===== */
.icr-workspace { margin-top: 22px; }
.icr-change-file { background: none; border: none; color: var(--site-dark); font-weight: 600; font-size: .88em; cursor: pointer; padding: 0 0 16px; display: inline-flex; align-items: center; gap: 6px; }
.icr-change-file:hover { color: var(--site-dark); }

.icr-col-label { display: block; font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; margin-bottom: 8px; }

.icr-editor-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 24px; align-items: start; }

/* ===== Stage (interactive crop area) ===== */
.icr-stage-wrap { background: repeating-conic-gradient(#f1f3f6 0% 25%, #fff 0% 50%) 50% / 20px 20px; border: 1px solid #e5e7eb; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden; }
.icr-stage { position: relative; user-select: none; -webkit-user-select: none; touch-action: none; line-height: 0; }
.icr-stage img { display: block; max-width: 100%; height: auto; pointer-events: none; }

.icr-crop-box { position: absolute; border: 2px solid var(--site-light); box-shadow: 0 0 0 2000px rgba(15, 23, 42, .55); cursor: move; box-sizing: border-box; }
.icr-crop-grid { position: absolute; inset: 0; pointer-events: none; background-image:
    linear-gradient(to right, rgba(255,255,255,.55) 1px, transparent 1px),
    linear-gradient(to right, rgba(255,255,255,.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.55) 1px, transparent 1px);
  background-size: 33.333% 100%, 66.667% 100%, 100% 33.333%, 100% 66.667%;
  background-position: 0 0, 0 0, 0 0, 0 0; background-repeat: no-repeat; }

.icr-handle { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--site-light); border-radius: 50%; box-sizing: border-box; z-index: 2; }
.icr-handle-n  { top: -8px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.icr-handle-s  { bottom: -8px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.icr-handle-e  { right: -8px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.icr-handle-w  { left: -8px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.icr-handle-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.icr-handle-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.icr-handle-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.icr-handle-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }

/* ===== Aspect presets ===== */
.icr-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.icr-preset-btn { border: 1px solid #ddd; background: #fff; color: #374151; border-radius: 7px; padding: 8px 14px; font-size: .85em; font-weight: 600; cursor: pointer; transition: all .15s ease; }
.icr-preset-btn:hover { border-color: var(--site-light); color: var(--site-dark); }
.icr-preset-btn.active { background: var(--site-light); border-color: var(--site-light); color: #fff; }

/* ===== Side column ===== */
.icr-side-col { display: flex; flex-direction: column; }
.icr-preview-box { background: repeating-conic-gradient(#f1f3f6 0% 25%, #fff 0% 50%) 50% / 20px 20px; border: 1px solid #e5e7eb; border-radius: 10px; min-height: 160px; max-height: 240px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.icr-preview-box canvas { max-width: 100%; max-height: 224px; object-fit: contain; display: block; }
.icr-preview-meta { font-size: .82em; color: #6b7280; margin: 8px 0 0; text-align: center; min-height: 1.3em; }

/* ===== Controls ===== */
.icr-controls { border: 1px solid #eee; border-radius: 10px; padding: 18px 20px; background: #fafbfc; margin: 18px 0; }
.icr-field { margin-bottom: 16px; }
.icr-field:last-child { margin-bottom: 0; }
.icr-field label { display: block; font-size: .85em; font-weight: 600; color: #374151; margin-bottom: 6px; }
.icr-field select, .icr-field input[type="number"] { width: 100%; border: 1px solid #ddd; border-radius: 7px; padding: 9px 10px; font-size: .92em; box-sizing: border-box; background: #fff; color: #23272f; }

.icr-size-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; margin-bottom: 0; }
.icr-link-btn { border: 1px solid #ddd; background: #fff; color: #6b7280; border-radius: 7px; width: 38px; height: 38px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .95em; transition: all .15s ease; }
.icr-link-btn:hover { border-color: var(--site-light); color: var(--site-dark); }
.icr-link-btn.active { background: var(--site-light); border-color: var(--site-light); color: #fff; }

.icr-btn { border: none; border-radius: 8px; padding: 13px 26px; font-weight: 700; cursor: pointer; font-size: .98em; display: flex; align-items: center; gap: 8px; background: var(--site-light); color: #fff; width: 100%; justify-content: center; transition: filter .15s ease; }
.icr-btn:disabled { opacity: .45; cursor: not-allowed; }
.icr-btn:not(:disabled):hover { filter: brightness(1.08); }

.icr-status { text-align: center; color: #6b7280; font-size: .88em; margin-top: 12px; min-height: 1.3em; }
.icr-status:empty { display: none; }

@media (max-width: 820px) {
    .icr-editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .icr-size-row { grid-template-columns: 1fr; }
    .icr-link-btn { justify-self: start; }
}
