/* Base64 Image Converter — Input → Processing → Result flow shape, same as
   Deecliq Data Transfer / PDF Merger. */
.idc-fit.idc-scope {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1600px; margin: 0 auto;
  padding: 90px 4vw 60px;
}

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

#idcScope .idc-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;
}

/* ── Encode / Decode mode toggle — a clean centered segmented control ── */
.idc-mode-toggle {
  display: flex; gap: 4px; background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0); border-radius: 14px; padding: 5px;
  margin: 0 auto 20px; max-width: 380px; box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.idc-mode-btn {
  flex: 1; border: none; background: transparent; padding: 11px 0; border-radius: 10px;
  font-size: .85rem; font-weight: 700; color: var(--txt-2, #64748b); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.idc-mode-btn:hover:not(.idc-mode-active) { background: var(--page-bg, #f8fafc); color: var(--txt, #0f172a); }
.idc-mode-btn.idc-mode-active {
  background: linear-gradient(135deg, var(--brand, #f59e0b), var(--brand-dark, #b45309));
  color: #fff; box-shadow: 0 6px 16px rgba(245,158,11,.35);
}

.idc-input-view { display: flex; flex-direction: column; }

/* ── Dropzone ── */
.idc-input-view > .idc-dropzone { min-height: 260px; }
.idc-scope .idc-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;
}
.idc-scope .idc-dropzone:hover, .idc-scope .idc-dropzone.idc-dragover {
  border-color: var(--brand-dark, #b45309); background: rgba(245,158,11,.06);
}
.idc-scope .idc-dropzone i {
  color: var(--brand, #f59e0b); font-size: 2.2rem;
  animation: idcIconFloat 2.4s ease-in-out infinite;
}
@keyframes idcIconFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .idc-scope .idc-dropzone i { animation: none; } }
.idc-drop-title { font-weight: 700; margin-top: 10px; font-size: .95rem; color: var(--txt, #0f172a); }
.idc-drop-sub { font-size: .8rem; opacity: .65; margin-top: 4px; color: var(--txt-2, #64748b); }

.idc-file-row {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
}
.idc-file-row i.fa-file-image { font-size: 1.4rem; color: var(--brand, #f59e0b); }
.idc-file-name { font-weight: 700; font-size: .88rem; color: var(--txt, #0f172a); word-break: break-all; }
.idc-file-size { font-size: .76rem; color: var(--txt-2, #64748b); }
.idc-remove {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--red, #ef4444); border: none; border-radius: 50%;
  color: #fff; font-size: .85rem; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.idc-remove:hover { background: #dc2626; transform: scale(1.08); }

/* ── Decode textarea ── */
.idc-decode-label {
  font-size: .82rem; font-weight: 700; color: var(--txt-2, #64748b);
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.idc-decode-label i { color: var(--brand, #f59e0b); }
.idc-decode-textarea {
  width: 100%; min-height: 200px; resize: vertical;
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--surface, #fff); color: var(--txt, #0f172a);
  padding: 14px 16px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: .82rem; line-height: 1.5;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.idc-decode-textarea:focus { border-color: var(--brand, #f59e0b); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }

#idcScope #idcConvertBtn, #idcScope #idcRenderBtn, #idcScope #idcCopyBtn {
  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;
}
#idcScope #idcConvertBtn:hover, #idcScope #idcRenderBtn:hover, #idcScope #idcCopyBtn:hover {
  transform: translateY(-2px); box-shadow: 0 14px 30px rgba(245,158,11,.45);
}
#idcScope #idcConvertBtn:active, #idcScope #idcRenderBtn:active, #idcScope #idcCopyBtn:active { transform: translateY(0); }
#idcScope .btn-warning { padding: 13px 26px; font-weight: 700; font-size: .95rem; border-radius: 12px; }

.idc-shake { animation: idcShake .4s ease; }
@keyframes idcShake {
  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) { .idc-shake { animation: none; } }

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

.idc-process-steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 18px; }
.idc-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;
}
.idc-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;
}
.idc-process-line { width: 36px; height: 2px; background: var(--border, #e2e8f0); }
.idc-process-step.idc-step-active { opacity: 1; }
.idc-process-step.idc-step-active .idc-process-icon {
  border-color: var(--brand, #f59e0b); color: var(--brand, #f59e0b);
  box-shadow: 0 0 0 4px rgba(245,158,11,.12);
  animation: idcPulseStep 1.1s ease-in-out infinite;
}
.idc-process-step.idc-step-done { opacity: 1; }
.idc-process-step.idc-step-done .idc-process-icon { border-color: #16a34a; color: #fff; background: #16a34a; }
@keyframes idcPulseStep {
  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) { .idc-process-step.idc-step-active .idc-process-icon { animation: none; } }

.idc-progress-text { font-size: .85rem; margin-top: 8px; color: var(--txt, #0f172a); font-weight: 600; text-align: center; }

/* ── Result screen: image on the LEFT, output on the RIGHT ──
   Compact header instead of a big centered icon+heading eating vertical
   space — a small inline check + title on one line. */
.idc-result-head {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 14px;
}
.idc-result-icon { font-size: 1.3rem; color: #16a34a; margin-bottom: 0; }
.idc-result-head h3 { font-size: .95rem !important; font-weight: 800 !important; color: var(--txt, #0f172a) !important; margin: 0 !important; }

.idc-result-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .idc-result-two-col { grid-template-columns: 1fr; } }
/* Decode result: the pasted code (text) sits on the LEFT and the rendered
   image on the RIGHT — the reverse of Encode's image-left/code-right —
   achieved by swapping grid order rather than moving DOM nodes around. */
.idc-result-two-col.idc-decode-result .idc-preview-section { order: 2; }
.idc-result-two-col.idc-decode-result .idc-output-section { order: 1; }

/* Both columns share the same header row height (.idc-output-header),
   so the actual boxes below them line up at exactly the same top edge —
   not just the same height as each other. Each section also needs its
   OWN explicit height — without it, #idcOutput's "flex:1" has nothing to
   grow into and the box just shrinks to fit its content instead of
   actually matching the preview box. */
.idc-preview-section, .idc-output-section { display: flex; flex-direction: column; height: 360px; }

/* Both result boxes are the exact same fixed height — neither grows with
   its content — so the buttons below always sit in the same place and
   the page itself never needs scrolling just because the Base64 string
   is long; only the output box scrolls internally for that. */
.idc-result-preview {
  display: flex; align-items: center; justify-content: center;
  flex: 1; min-height: 0;
  border-radius: 12px; background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  padding: 12px; overflow: hidden;
}
.idc-result-preview img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }

.idc-output-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; flex-shrink: 0; }
.idc-output-label { font-size: .8rem; font-weight: 700; color: var(--txt-2, #64748b); display: flex; align-items: center; gap: 6px; }
.idc-output-label i { color: var(--brand, #f59e0b); }
.idc-char-count { font-size: .74rem; color: var(--txt-2, #64748b); }
/* Visible scrollbar (neutral gray, not the brand orange) when the Base64
   text overflows the fixed box — so you scroll the box, not the page. */
#idcOutput {
  width: 100%; flex: 1; min-height: 0; resize: none;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--surface, #fff); color: var(--txt, #0f172a);
  padding: 12px 14px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: .78rem; line-height: 1.5;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
#idcOutput::-webkit-scrollbar { width: 8px; }
#idcOutput::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
#idcOutput::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] #idcOutput { scrollbar-color: #475569 transparent; }
html[data-theme="dark"] #idcOutput::-webkit-scrollbar-thumb { background: #475569; }
#idcOutput:focus { border-color: var(--brand, #f59e0b); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
#idcOutput.idc-output-selected { border-color: var(--brand, #f59e0b); box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.idc-decode-textarea { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.idc-decode-textarea::-webkit-scrollbar { width: 8px; }
.idc-decode-textarea::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.idc-decode-textarea::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] .idc-decode-textarea { scrollbar-color: #475569 transparent; }
html[data-theme="dark"] .idc-decode-textarea::-webkit-scrollbar-thumb { background: #475569; }

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

@media (max-width: 500px) {
  .idc-fit.idc-scope { padding: 90px 4vw 30px; }
  .idc-preview-section, .idc-output-section { height: 260px; }
}
