/* Image Converter — matches the PDF Merger / HTML Merger shape, plus an
   options popup (format/resize/filters) before processing. */
.ict-fit.ict-scope {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1600px; margin: 0 auto;
  padding: 90px 4vw 60px;
}

.ict-hero { text-align: center; flex-shrink: 0; }
.ict-hero h1 {
  font-size: 1.5rem !important; font-weight: 800 !important;
  color: var(--brand, #f59e0b) !important;
  margin: 0 0 4px !important;
}
#ictScope .ict-hero p {
  font-size: .85rem !important; color: var(--txt-2, #64748b) !important;
  margin: 0 auto !important; max-width: 720px;
}

#ictScope .ict-card {
  max-width: 100% !important; width: 100%;
  padding: 24px 32px !important;
  background: var(--page-bg, #f8fafc) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  box-shadow: none !important;
  margin: 0 auto !important;
}
.ict-input-view { display: flex; flex-direction: column; }

.ict-input-section { display: flex; min-height: 280px; }
.ict-scope .ict-dropzone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 20px; border: 2px dashed var(--brand, #f59e0b); border-radius: 14px;
  cursor: pointer; text-align: center; color: var(--txt, #0f172a);
  background: transparent; transition: border-color .2s ease, background .2s ease;
}
.ict-scope .ict-dropzone:hover, .ict-scope .ict-dropzone.ict-dragover {
  border-color: var(--brand-dark, #b45309); background: rgba(245,158,11,.06);
}
.ict-scope .ict-dropzone i {
  color: var(--brand, #f59e0b); font-size: 2.2rem;
  animation: ictIconFloat 2.4s ease-in-out infinite;
}
@keyframes ictIconFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .ict-scope .ict-dropzone i { animation: none; } }
.ict-drop-title { font-weight: 700; margin-top: 10px; font-size: .95rem; color: var(--txt, #0f172a); }
.ict-drop-sub { font-size: .8rem; opacity: .65; margin-top: 4px; color: var(--txt-2, #64748b); }

/* ── File list ── */
.ict-file-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 4px; font-size: .82rem; color: var(--txt-2, #64748b);
}
.ict-add-more { display: inline-flex; align-items: center; gap: 6px; color: var(--brand, #f59e0b); font-weight: 700; font-size: .82rem; cursor: pointer; }
.ict-add-more:hover { text-decoration: underline; }

.ict-file-list, .ict-result-list {
  list-style: none; margin: 8px 0 0; padding: 4px;
  display: block;
  max-height: 420px; overflow-y: auto;
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--page-bg, #f8fafc);
}
.ict-file-chip, .ict-result-chip { margin-bottom: 8px; }
.ict-file-chip:last-child, .ict-result-chip:last-child { margin-bottom: 0; }
.ict-file-chip, .ict-result-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
}
.ict-chip-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--page-bg, #f1f5f9); }
.ict-chip-name { flex: 1; min-width: 0; font-weight: 600; font-size: .85rem; color: var(--txt, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ict-chip-size { font-size: .76rem; color: var(--txt-2, #64748b); flex-shrink: 0; }
.ict-chip-arrow { color: var(--txt-2, #94a3b8); flex-shrink: 0; }
.ict-chip-newsize { font-size: .76rem; color: #16a34a; font-weight: 700; flex-shrink: 0; }
.ict-chip-remove, .ict-chip-download, .ict-chip-crop {
  width: 26px; height: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; color: #fff; font-size: .78rem; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.ict-chip-remove { background: var(--red, #ef4444); }
.ict-chip-remove:hover { background: #dc2626; transform: scale(1.08); }
.ict-chip-download { background: var(--brand, #f59e0b); }
.ict-chip-download:hover { background: var(--brand-dark, #b45309); transform: scale(1.08); }
.ict-chip-crop { background: var(--txt-2, #64748b); }
.ict-chip-crop:hover { background: var(--brand, #f59e0b); transform: scale(1.08); }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }
#ictScope #ictOptionsBtn, #ictScope #ictApplyOptionsBtn, #ictScope #ictDownloadAllBtn {
  background: linear-gradient(135deg, var(--brand, #f59e0b), var(--brand-dark, #b45309));
  border: none; padding: 13px 26px; font-weight: 700; font-size: .95rem; border-radius: 12px;
  box-shadow: 0 10px 24px rgba(245,158,11,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
#ictScope #ictOptionsBtn:hover, #ictScope #ictApplyOptionsBtn:hover, #ictScope #ictDownloadAllBtn:hover {
  transform: translateY(-2px); box-shadow: 0 14px 30px rgba(245,158,11,.45);
}
#ictScope .btn-warning { padding: 13px 26px; font-weight: 700; font-size: .95rem; border-radius: 12px; }

.ict-shake { animation: ictShake .4s ease; }
@keyframes ictShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .ict-shake { animation: none; } }

/* ── Processing ── */
.ict-processing { padding: 10px 0 4px; }
.ict-ring-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 18px; }
.ict-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ict-ring-track { fill: none; stroke: var(--border, #e2e8f0); stroke-width: 8; }
.ict-ring-fill {
  fill: none; stroke: var(--brand, #f59e0b); stroke-width: 8;
  stroke-linecap: round; transition: stroke-dashoffset .2s ease;
  filter: drop-shadow(0 0 6px rgba(245,158,11,.45));
}
.ict-ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--txt, #0f172a); }
.ict-ring-count { font-size: 2.1rem; line-height: 1; }
.ict-ring-percent { font-size: 1.1rem; opacity: .7; margin-left: 2px; }

.ict-process-steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 22px; }
.ict-process-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; color: var(--txt-2, #64748b);
  opacity: .55; transition: opacity .2s ease;
}
.ict-process-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface, #fff); border: 2px solid var(--border, #e2e8f0);
  color: var(--txt-2, #64748b); font-size: .9rem;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.ict-process-line { width: 30px; height: 2px; background: var(--border, #e2e8f0); }
.ict-process-step.ict-step-active { opacity: 1; }
.ict-process-step.ict-step-active .ict-process-icon {
  border-color: var(--brand, #f59e0b); color: var(--brand, #f59e0b);
  box-shadow: 0 0 0 4px rgba(245,158,11,.12);
  animation: ictPulseStep 1.3s ease-in-out infinite;
}
.ict-process-step.ict-step-done { opacity: 1; }
.ict-process-step.ict-step-done .ict-process-icon { border-color: #16a34a; color: #fff; background: #16a34a; }
@keyframes ictPulseStep {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245,158,11,.12); }
  50%      { box-shadow: 0 0 0 8px rgba(245,158,11,.04); }
}
@media (prefers-reduced-motion: reduce) { .ict-process-step.ict-step-active .ict-process-icon { animation: none; } }
.ict-progress-text { font-size: .85rem; margin-top: 10px; color: var(--txt, #0f172a); font-weight: 600; text-align: center; }

/* ── Result ── */
.ict-result-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.ict-result-icon { font-size: 1.4rem; color: #16a34a; }
.ict-result-head h3 { font-size: 1rem !important; font-weight: 800 !important; color: var(--txt, #0f172a) !important; margin: 0 !important; }
.ict-result-summary { font-size: .82rem !important; color: var(--txt-2, #64748b) !important; margin: 0 0 12px !important; }

.hidden { display: none !important; }
.ict-autosave { margin-top: 10px; text-align: center; font-size: .82rem; color: var(--txt-2, #64748b); }

/* ── Options modal ── */
.ict-modal {
  position: fixed; inset: 0; z-index: 100060;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.ict-modal.ict-modal-open { display: flex; }
.ict-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.6); animation: ictFadeIn .15s ease; }
.ict-modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 520px; max-height: 90vh;
  background: var(--surface, #fff); border-radius: 18px; padding: 26px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35); animation: ictPopIn .18s ease;
  display: flex; flex-direction: column;
}
.ict-modal-title { margin: 0 0 2px; font-size: 1.1rem; font-weight: 800; color: var(--txt, #0f172a); display: flex; align-items: center; gap: 8px; }
.ict-modal-title i { color: var(--brand, #f59e0b); }
.ict-modal-sub { margin: 0 0 16px; font-size: .8rem; color: var(--txt-2, #64748b); }
.ict-modal-close {
  position: absolute; top: -12px; right: -12px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand, #f59e0b); color: #fff; border: none; cursor: pointer; font-size: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.ict-modal-body { overflow-y: auto; flex: 1; padding-right: 4px; }
.ict-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-shrink: 0; }
@keyframes ictFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes ictPopIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* ── Options accordion — one clearly-labelled section at a time instead of
   one long unbroken wall of controls. ── */
.ict-accordion { display: flex; flex-direction: column; gap: 8px; }
.ict-acc-section {
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--page-bg, #f8fafc); overflow: hidden;
}
.ict-acc-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border: none; background: transparent; cursor: pointer;
  font-size: .86rem; font-weight: 700; color: var(--txt, #0f172a); text-align: left;
}
.ict-acc-header-left { display: flex; align-items: center; gap: 9px; }
.ict-acc-header-left i.fa-solid:first-child { color: var(--brand, #f59e0b); width: 16px; text-align: center; }
.ict-acc-badge {
  font-size: .66rem; font-weight: 700; color: var(--brand-dark, #b45309);
  background: rgba(245,158,11,.14); padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.ict-acc-chevron { color: var(--txt-2, #64748b); font-size: .78rem; transition: transform .2s ease; flex-shrink: 0; }
.ict-acc-section.ict-acc-open .ict-acc-chevron { transform: rotate(180deg); }
.ict-acc-content {
  max-height: 0; overflow: hidden; transition: max-height .25s ease;
}
.ict-acc-section.ict-acc-open .ict-acc-content { max-height: 900px; }
.ict-acc-content > .ict-opt-group { padding: 0 16px 16px; margin-bottom: 0; }
.ict-acc-content .ict-opt-row { padding: 0 16px 16px; margin-bottom: 0; }
.ict-acc-content .ict-opt-row:first-child { padding-top: 2px; }

.ict-opt-group { margin-bottom: 14px; }
.ict-opt-row { margin-bottom: 14px; }
.ict-opt-label { display: block; font-size: .82rem; font-weight: 700; color: var(--txt, #0f172a); margin-bottom: 8px; }
.ict-opt-hint { font-weight: 500; color: var(--txt-2, #64748b); font-size: .74rem; }
.ict-opt-divider { height: 1px; background: var(--border, #e2e8f0); margin: 16px 0; }

.ict-format-pills, .ict-resize-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ict-pill {
  border: 1px solid var(--border, #e2e8f0); background: var(--page-bg, #f8fafc);
  color: var(--txt-2, #64748b); font-size: .78rem; font-weight: 700;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ict-pill:hover { border-color: var(--brand, #f59e0b); }
.ict-pill.ict-pill-active { background: var(--brand, #f59e0b); color: #fff; border-color: var(--brand, #f59e0b); }

.ict-resize-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ict-resize-row input[type="number"] {
  width: 90px; height: 36px; padding: 0 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
  background: var(--page-bg, #f8fafc); color: var(--txt, #0f172a); font-size: .85rem;
}
.ict-resize-row span { color: var(--txt-2, #64748b); font-size: .85rem; }
.ict-checkbox { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--txt-2, #64748b); cursor: pointer; }
.ict-checkbox input { accent-color: var(--brand, #f59e0b); }

.ict-sliders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.ict-slider-item label { display: block; font-size: .76rem; font-weight: 600; color: var(--txt-2, #64748b); margin-bottom: 4px; }
.ict-slider-item input[type="range"] { width: 100%; accent-color: var(--brand, #f59e0b); }

input[type="range"] { accent-color: var(--brand, #f59e0b); }

html[data-theme="dark"] #ictScope .ict-card { background: var(--surface, #11111a) !important; }
html[data-theme="dark"] .ict-modal-box { background: var(--surface, #11111a); }

/* ── Crop ── */
.ict-crop-wrap {
  position: relative; width: 100%; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--border, #e2e8f0);
  background: #0f172a; margin-top: 10px; touch-action: none;
}
.ict-crop-preview-img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.ict-crop-box {
  position: absolute; border: 2px solid #f59e0b; cursor: move;
  box-shadow: 0 0 0 2000px rgba(15,23,42,.55);
}
.ict-crop-handle {
  position: absolute; width: 14px; height: 14px; background: #f59e0b;
  border: 2px solid #fff; border-radius: 50%;
}
.ict-crop-handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.ict-crop-handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.ict-crop-handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.ict-crop-handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
#ictCropAspectPills { margin-top: 10px; align-items: center; }
.ict-opt-label .ict-checkbox { margin-right: 4px; }

/* ── Full-screen crop editor — its own overlay above the options popup, so
   the image renders large with nothing competing for space, and closing
   it never collapses or hides the other conversion options behind it. ── */
.ict-crop-modal {
  position: fixed; inset: 0; z-index: 100070;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.ict-crop-modal.ict-modal-open { display: flex; }
.ict-crop-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.75); animation: ictFadeIn .15s ease; }
.ict-crop-modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 860px;
  background: var(--surface, #fff); border-radius: 18px; padding: 22px 26px;
  box-shadow: 0 30px 60px rgba(0,0,0,.4); animation: ictPopIn .18s ease;
  max-height: 92vh; overflow-y: auto;
}
.ict-crop-modal-head { display: flex; align-items: center; justify-content: space-between; }
.ict-crop-modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--txt, #0f172a); display: flex; align-items: center; gap: 8px; }
.ict-crop-modal-head h3 i { color: var(--brand, #f59e0b); }
.ict-crop-modal-sub { margin: 4px 0 14px; font-size: .8rem; color: var(--txt-2, #64748b); }
.ict-crop-modal-footer { display: flex; justify-content: flex-end; margin-top: 16px; }

/* The wrap's height is set inline by JS to match the image's own aspect
   ratio at a large on-screen size — so the full image is always visible,
   uncropped and undistorted, never letterboxed or cut off. */
.ict-crop-wrap {
  position: relative; width: 100%; max-height: 70vh;
  overflow: hidden; border-radius: 10px; border: 1px solid var(--border, #e2e8f0);
  background: #0f172a; touch-action: none;
}
.ict-crop-preview-img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }

@media (max-width: 500px) {
  .ict-sliders-grid { grid-template-columns: 1fr; }
  .ict-crop-modal-box { padding: 16px; }
}
