/* PDF TOC Generator — matches the Deecliq Data Transfer shape, with a
   builder stage (headings + bookmarks + settings) standing in for the
   usual settings modal. */
.toc-fit.toc-scope {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 1600px; margin: 0 auto;
  padding: 90px 4vw 60px;
}

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

#tocScope .toc-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;
}
.toc-input-view { display: flex; flex-direction: column; }

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

.toc-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);
}
.toc-file-row i.fa-file-pdf { font-size: 1.4rem; color: var(--brand, #10b981); }
.toc-file-name { font-weight: 700; font-size: .88rem; color: var(--txt, #0f172a); word-break: break-all; }
.toc-file-size { font-size: .76rem; color: var(--txt-2, #64748b); }
.toc-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;
}
.toc-remove:hover { background: #dc2626; transform: scale(1.08); }

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

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

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

#tocScope #tocUploadBtn,
#tocScope #tocGenerateBtn,
#tocScope #tocDownloadBtn {
  background: linear-gradient(135deg, var(--brand, #10b981), var(--brand-dark, #059669));
  border: none;
  padding: 13px 26px;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(16,185,129,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
#tocScope #tocUploadBtn:hover,
#tocScope #tocGenerateBtn:hover,
#tocScope #tocDownloadBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(16,185,129,.45);
}
#tocScope #tocUploadBtn:active,
#tocScope #tocGenerateBtn:active,
#tocScope #tocDownloadBtn:active { transform: translateY(0); }
#tocScope .btn-warning { padding: 13px 26px; font-weight: 700; font-size: .95rem; border-radius: 12px; }

/* ── Builder stage ── */
.toc-builder-view { display: flex; flex-direction: column; gap: 18px; }

.toc-step-indicator {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 4px;
}
.toc-step-dot {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 700; color: var(--txt-2, #64748b);
  opacity: .55; transition: opacity .2s ease;
}
.toc-step-dot span {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  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: .8rem;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.toc-step-dot.active { opacity: 1; }
.toc-step-dot.active span { border-color: var(--brand, #10b981); color: var(--brand, #10b981); }
.toc-step-dot.done { opacity: 1; }
.toc-step-dot.done span { border-color: #16a34a; background: #16a34a; color: #fff; }
.toc-step-track { width: 40px; height: 2px; background: var(--border, #e2e8f0); }
.toc-section {
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px; padding: 18px 20px;
}
.toc-section h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; color: var(--txt, #0f172a); margin: 0 0 10px;
}
.toc-section h3 i { color: var(--brand, #10b981); }
.toc-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.toc-section-actions { display: flex; gap: 14px; }
.toc-link-btn {
  background: none; border: none; color: var(--brand, #10b981);
  font-size: .8rem; font-weight: 700; cursor: pointer; padding: 0;
}
.toc-link-btn:hover { text-decoration: underline; }
.toc-hint { font-size: .8rem; color: var(--txt-2, #64748b); margin: 0 0 12px; }

.toc-heading-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 6px;
  background: var(--page-bg, #f8fafc);
}
.toc-heading-empty { text-align: center; color: var(--txt-2, #64748b); font-size: .85rem; padding: 20px; }
.toc-heading-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
}
.toc-heading-item input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand, #10b981); }
.toc-heading-level {
  font-size: .68rem; font-weight: 800; color: #fff; background: var(--brand, #10b981);
  border-radius: 5px; padding: 2px 6px; flex-shrink: 0;
}
.toc-heading-text { flex: 1; min-width: 0; font-size: .85rem; color: var(--txt, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-heading-page { font-size: .76rem; color: var(--txt-2, #64748b); flex-shrink: 0; }

.toc-bookmark-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; margin-bottom: 12px; }
.toc-bookmark-list { display: flex; flex-direction: column; gap: 6px; }
.toc-bookmark-empty { text-align: center; color: var(--txt-2, #64748b); font-size: .85rem; padding: 14px; }
.toc-bookmark-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--page-bg, #f8fafc); border: 1px solid var(--border, #e2e8f0);
}
.toc-bookmark-level {
  font-size: .68rem; font-weight: 800; color: #fff; background: var(--brand-dark, #059669);
  border-radius: 5px; padding: 2px 6px; flex-shrink: 0;
}
.toc-bookmark-title { flex: 1; min-width: 0; font-size: .85rem; color: var(--txt, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-bookmark-page { font-size: .76rem; color: var(--txt-2, #64748b); flex-shrink: 0; }
.toc-bookmark-remove {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--red, #ef4444); border: none; border-radius: 50%;
  color: #fff; font-size: .72rem; cursor: pointer;
}
.toc-bookmark-remove:hover { background: #dc2626; }

.toc-settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 6px; }
.toc-settings-grid .form-group { margin: 0; }

.toc-checkbox-item {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; font-weight: 600; color: var(--txt, #0f172a);
  cursor: pointer; user-select: none;
}
.toc-checkbox-item input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toc-checkbox-box {
  width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
  border: 2px solid var(--border, #e2e8f0);
  display: inline-block; position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.toc-checkbox-item input[type="checkbox"]:checked + .toc-checkbox-box {
  border-color: var(--brand, #10b981); background: var(--brand, #10b981);
}
.toc-checkbox-item input[type="checkbox"]:checked + .toc-checkbox-box::after {
  content: '\2713'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .68rem; font-weight: 800;
}

@media (max-width: 700px) {
  .toc-bookmark-form { grid-template-columns: 1fr; }
  .toc-settings-grid { grid-template-columns: 1fr; }
}

/* ── Processing screen — identical ring + step pattern as Transfer. ── */
.toc-processing { padding: 10px 0 4px; }

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

.toc-process-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 22px;
}
.toc-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;
}
.toc-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;
}
.toc-process-line { width: 36px; height: 2px; background: var(--border, #e2e8f0); }
.toc-process-step.toc-step-active { opacity: 1; }
.toc-process-step.toc-step-active .toc-process-icon {
  border-color: var(--brand, #10b981);
  color: var(--brand, #10b981);
  box-shadow: 0 0 0 4px rgba(16,185,129,.12);
  animation: tocPulseStep 1.3s ease-in-out infinite;
}
.toc-process-step.toc-step-done { opacity: 1; }
.toc-process-step.toc-step-done .toc-process-icon {
  border-color: #16a34a; color: #fff; background: #16a34a;
}
@keyframes tocPulseStep {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
  50%      { box-shadow: 0 0 0 8px rgba(16,185,129,.04); }
}
@media (prefers-reduced-motion: reduce) {
  .toc-process-step.toc-step-active .toc-process-icon { animation: none; }
}

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

/* ── Result screen ── */
.toc-result-icon { text-align: center; font-size: 2.6rem; color: #16a34a; margin-bottom: 6px; }
.toc-autosave { margin-top: 10px; text-align: center; font-size: .82rem; color: var(--txt-2, #64748b); }

.hidden { display: none !important; }
#tocScope .controls.hidden { display: none !important; }
