/* ── Layout: nav bar → title → description → one big box → buttons →
   footer. Same recipe as Deecliq Data Transfer (the project default). ── */
.bg-fit.bg-scope {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1600px; margin: 0 auto;
  padding: 90px 4vw 60px;
}

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

/* Everything inside blends into the page background — only the dashed
   input box below is meant to stand out as the highlighted element. */
#bgScope .bg-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;
}


#bgScope .config-card {
  background: var(--page-bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px; padding: 20px 22px;
  margin-bottom: 16px; box-shadow: none;
}
#bgScope .config-card h3, #bgScope .section-card h3 {
  color: var(--txt, #0f172a); margin-bottom: 16px; font-size: 1rem;
  border-bottom: 2px solid var(--brand, #4f46e5); padding-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
#bgScope .config-card h3 i, #bgScope .section-card h3 i { color: var(--brand, #4f46e5); }

#bgScope .form-control,
#bgScope .form-group input[type=text],
#bgScope .form-group select,
#bgScope .form-group textarea {
  background: var(--surface, #fff);
  border-color: var(--border, #e2e8f0);
  color: var(--txt, #0f172a);
}

.hidden { display: none !important; }
#bgScope .controls {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  width: 100%;
}
#bgScope .controls.hidden { display: none !important; }
.btn-small { padding: 6px 12px; font-size: .78rem; }

#bgScope #bgGenerateBtn,
#bgScope #bgContinueBtn,
#bgScope #bgClearBtn,
#bgScope #bgGenerateBatchBtn,
#bgScope #bgSettingsNextBtn {
  padding: 15px 30px !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  border-radius: 12px !important;
}
#bgScope #bgGenerateBtn,
#bgScope #bgContinueBtn,
#bgScope #bgSettingsNextBtn {
  background: linear-gradient(135deg, var(--brand, #4f46e5), var(--brand-dark, #4338ca));
  border: none;
  box-shadow: 0 10px 24px rgba(79,70,229,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
#bgScope #bgGenerateBtn:hover,
#bgScope #bgContinueBtn:hover,
#bgScope #bgSettingsNextBtn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(79,70,229,.45); }
#bgScope #bgGenerateBtn:active,
#bgScope #bgContinueBtn:active,
#bgScope #bgSettingsNextBtn:active { transform: translateY(0); }

/* ── Main "Enter Data" input — the dashed-highlighted element, same idea
   as the dropzone in Deecliq Data Transfer / Add Page Numbers to PDF. ── */
.bg-input-section { margin-bottom: 16px; }
.bg-dropzone {
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 20px;
  border: 2px dashed var(--brand, #4f46e5);
  border-radius: 14px;
  cursor: text;
  text-align: center;
  color: var(--txt, #0f172a);
  background: transparent;
  transition: border-color .2s ease, background .2s ease;
}
.bg-dropzone:hover, .bg-dropzone.bg-focused {
  border-color: var(--brand-dark, #4338ca);
  background: rgba(79,70,229,.05);
}
.bg-dropzone i { color: var(--brand, #4f46e5); font-size: 1.6rem; }
.bg-drop-title { font-weight: 700; margin: 8px 0 14px; font-size: .9rem; }
#bgScope #bgTextInput {
  width: 100%; text-align: center;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  color: var(--txt, #0f172a);
  padding: 18px 16px; font-size: 1.05rem;
}

/* Image / Batch inputs swap in inside the SAME dashed box instead of a
   separate section underneath — same one-box approach as the Transfer
   tool, where everything for the current mode lives in one place. */
.bg-inbox-section {
  width: 100%; margin-bottom: 14px; text-align: left;
  border-radius: 10px; padding: 4px; border: 2px dashed transparent;
  transition: border-color .15s ease, background .15s ease;
}
.bg-inbox-section.bg-inbox-dragover {
  border-color: var(--brand-dark, #4338ca);
  background: rgba(79,70,229,.08);
}
.bg-inbox-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--txt-2, #64748b); margin-bottom: 6px;
}
#bgScope .bg-inbox-section .form-control { background: var(--surface, #fff); }

.bg-examples, .bg-mode-toggles { width: 100%; }

.bg-optional { font-size: .75rem; font-weight: 500; opacity: .6; text-transform: none; }

/* ── Processing: same big animated ring + counter used across the
   project's tools. Generation here is instant (canvas draw), so this is
   shown for a short fixed duration just to read as a real step, not a
   frozen screen. ── */
.bg-processing { padding: 30px 0; text-align: center; }
.bg-process-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 22px;
}
.bg-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;
}
.bg-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;
}
.bg-process-line { width: 36px; height: 2px; background: var(--border, #e2e8f0); }
.bg-process-step.bg-step-active { opacity: 1; }
.bg-process-step.bg-step-active .bg-process-icon {
  border-color: var(--brand, #4f46e5);
  color: var(--brand, #4f46e5);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
  animation: bgPulseStep 1.3s ease-in-out infinite;
}
.bg-process-step.bg-step-done { opacity: 1; }
.bg-process-step.bg-step-done .bg-process-icon {
  border-color: #16a34a; color: #fff; background: #16a34a;
}
@keyframes bgPulseStep {
  0%, 100% { box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
  50%      { box-shadow: 0 0 0 8px rgba(79,70,229,.04); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-process-step.bg-step-active .bg-process-icon { animation: none; }
}
.bg-ring-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 18px; }
.bg-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.bg-ring-track { fill: none; stroke: var(--border, #e2e8f0); stroke-width: 8; }
.bg-ring-fill {
  fill: none; stroke: var(--brand, #4f46e5); stroke-width: 8;
  stroke-linecap: round;
  transition: stroke .2s ease;
  filter: drop-shadow(0 0 6px rgba(79,70,229,.45));
}
.bg-ring-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--txt, #0f172a);
}
.bg-ring-count { font-size: 2.1rem; line-height: 1; }
.bg-ring-percent { font-size: 1.1rem; opacity: .7; margin-left: 2px; }
.bg-progress-text { font-size: .85rem; font-weight: 600; color: var(--txt, #0f172a); }

.bg-result-icon { text-align: center; font-size: 2.6rem; color: #16a34a; margin-bottom: 6px; }
.bg-result-canvas-wrap {
  display: flex; justify-content: center; margin: 16px 0;
  padding: 16px; border-radius: 14px;
  background: var(--page-bg, #f8fafc); border: 1px solid var(--border, #e2e8f0);
}
.bg-result-canvas-wrap canvas { max-width: 100%; border-radius: 8px; }
.bg-autosave { text-align: center; font-size: .8rem; color: var(--txt-2, #64748b); margin-top: 14px; }
.bg-autosave strong { color: var(--brand, #4f46e5); }

.bg-color-section { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.bg-color-group { text-align: center; }
.bg-color-preview {
  width: 46px; height: 46px; border-radius: 10px; margin: 0 auto 8px;
  border: 3px solid var(--border, #e2e8f0); cursor: pointer; transition: transform .2s;
}
.bg-color-preview:hover { transform: scale(1.08); }
.bg-color-input { opacity: 0; position: absolute; pointer-events: none; }
.bg-color-group label { font-size: .8rem; color: var(--txt-2, #64748b); }

.bg-examples { margin-top: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bg-examples small { color: var(--txt-2, #64748b); margin-right: 4px; }

/* Toggles that reveal the optional Image / Batch sections — same idea
   as the Transfer tool's single-focused-action-first approach: only the
   main text input is shown by default, everything else stays out of the
   way until explicitly switched on. */
.bg-mode-toggles {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 14px; flex-wrap: wrap;
}
.bg-mode-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--txt-2, #64748b);
  font-size: .82rem; font-weight: 600;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.bg-mode-toggle:hover { border-color: var(--brand, #4f46e5); color: var(--brand, #4f46e5); }
.bg-mode-toggle.bg-mode-active {
  background: linear-gradient(135deg, var(--brand, #4f46e5), var(--brand-dark, #4338ca));
  border-color: transparent;
  color: #fff;
}

.bg-error {
  margin-top: 12px; padding: 10px 14px;
  border-radius: 10px;
  background: var(--page-bg, #f8fafc);
  border: 1px dashed var(--brand, #4f46e5);
  color: var(--txt, #0f172a); font-size: .85rem;
}

#bgImagePreview { text-align: center; margin: 14px 0; }
#bgImagePreview img { max-width: 150px; max-height: 150px; border-radius: 10px; border: 2px solid var(--brand, #4f46e5); }
#bgImagePreview p { margin-top: 8px; color: var(--txt-2, #64748b); font-size: .85rem; }
.bg-hint { font-size: .78rem; color: var(--txt-2, #64748b); margin-top: 6px; }

.bg-textarea-large { height: 110px; resize: vertical; font-family: 'Consolas', 'Monaco', monospace; }

.bg-loading { text-align: center; padding: 20px; color: var(--txt-2, #64748b); font-weight: 600; }
.bg-spinner {
  display: inline-block; width: 18px; height: 18px; margin-right: 8px;
  border: 3px solid rgba(79,70,229,.25); border-radius: 50%; border-top-color: var(--brand, #4f46e5);
  animation: bg-spin 1s linear infinite; vertical-align: middle;
}
@keyframes bg-spin { to { transform: rotate(360deg); } }

.bg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.bg-preview-card {
  background: var(--page-bg, #f8fafc); border: 2px solid var(--border, #e2e8f0); border-radius: 14px;
  padding: 16px; text-align: center; transition: transform .2s, border-color .2s;
}
.bg-preview-card:hover { transform: translateY(-3px); border-color: var(--brand, #4f46e5); }
.bg-preview-card canvas { width: 100%; max-width: 180px; height: auto; margin: 10px 0; border-radius: 6px; }
.bg-preview-type { color: var(--brand, #4f46e5); font-size: .75rem; font-weight: 700; text-transform: uppercase; }
.bg-preview-data { color: var(--txt, #0f172a); font-weight: 600; margin: 6px 0 10px; word-break: break-all; font-size: .85rem; }
.bg-preview-actions { display: flex; gap: 6px; justify-content: center; }

.bg-howto-card {
  background: var(--page-bg, #f8fafc) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  border-radius: 14px !important;
  padding: 20px 22px !important;
  box-shadow: none !important;
  margin-top: 10px !important;
}
.bg-howto { color: var(--txt-2, #64748b); line-height: 1.8; padding-left: 20px; font-size: .88rem; margin: 0 0 12px; }
.bg-note { font-size: .82rem; color: var(--txt-2, #64748b); display: flex; align-items: flex-start; gap: 8px; margin: 0; }

.bg-shake { animation: bgShake .4s ease; }
@keyframes bgShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(3px); }
}

/* ── Centered message popup — same pattern used across the project. ── */
/* ── Settings / Colors popups — same pattern as Add Page Numbers to
   PDF's settings modal, just split into two sequential steps. ── */
.bg-modal {
  position: fixed; inset: 0; z-index: 100001;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.bg-modal.bg-modal-open { display: flex; }
.bg-modal-backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.6);
  animation: bgFadeIn .15s ease;
}
.bg-modal-box {
  position: relative; z-index: 1;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  padding: 28px 30px;
  border-radius: 18px;
  max-width: 460px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  animation: bgPopIn .2s ease;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.bg-modal-box h3 {
  display: flex; align-items: center; gap: 8px;
  color: var(--txt, #0f172a); margin: 0 0 4px; padding-right: 36px;
}
.bg-modal-box h3 i { color: var(--brand, #4f46e5); }
.bg-modal-sub { font-size: .8rem; color: var(--txt-2, #64748b); margin: 0 0 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.bg-modal-x {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--page-bg, #f8fafc); color: var(--txt-2, #64748b); border: 1px solid var(--border, #e2e8f0);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.bg-modal-x:hover { background: var(--brand, #4f46e5); color: #fff; border-color: var(--brand, #4f46e5); }
@keyframes bgFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bgPopIn {
  from { opacity: 0; transform: scale(.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-modal-backdrop, .bg-modal-box { animation: none; }
}

.bg-popup {
  position: fixed; inset: 0; z-index: 100002;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.bg-popup.bg-popup-open { display: flex; }
.bg-popup-backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.6);
  animation: bgPopupFadeIn .15s ease;
}
.bg-popup-box {
  position: relative; z-index: 1;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  padding: 28px 30px;
  border-radius: 18px;
  max-width: 420px; width: 100%;
  text-align: center;
  animation: bgPopupPopIn .2s ease;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
  white-space: pre-line;
}
.bg-popup-icon { font-size: 2.2rem; margin-bottom: 10px; }
.bg-popup-box.bg-popup-info .bg-popup-icon    { color: var(--brand, #4f46e5); }
.bg-popup-box.bg-popup-success .bg-popup-icon { color: #16a34a; }
.bg-popup-box.bg-popup-warning .bg-popup-icon { color: #d97706; }
.bg-popup-box.bg-popup-error .bg-popup-icon    { color: #dc2626; }
.bg-popup-msg { color: var(--txt, #0f172a); font-size: .92rem; line-height: 1.6; margin-bottom: 18px; text-align: left; }
.bg-popup-ok { padding: 9px 28px !important; }
@keyframes bgPopupFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bgPopupPopIn {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-shake { animation: none; }
  .bg-popup-backdrop, .bg-popup-box { animation: none; }
}
