/* Ensure the HTML hidden attribute always wins over any display rule. */
[hidden] {
  display: none !important;
}



#app {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ===== Header ===== */
.tool-header {
  text-align: center;
  background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
  color: #FFFFFF;
  padding: 31px;
  border-radius: 15px;
  margin-bottom: 10px;
  box-shadow: 0 10px 30px rgba(30, 58, 138, 0.2);
}

.tool-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* ===== Step Indicator ===== */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 24px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background-color: #FFFFFF;
  border: 1px solid #E3E8F4;
  font-size: 14px;
  color: #64748B;
  font-weight: 500;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #E3E8F4;
  color: #64748B;
  font-weight: 700;
  font-size: 13px;
}

.step.active {
  background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(75, 133, 230, 0.25);
}

.step.active .step-number {
  background-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.step.done .step-number {
  background-color: #16A34A;
  color: #FFFFFF;
}

.step-connector {
  width: 28px;
  height: 2px;
  background-color: #E3E8F4;
  border-radius: 2px;
}

/* ===== Card ===== */
.card {
  background-color: #FFFFFF;
  border: 1px solid #4b85e6;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.08);
  padding: 32px;
}

/* ===== Upload zone ===== */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  background-color: #FBFCFF;
  transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone:focus {
  border-color: #4b85e6;
  background-color: #F0F5FF;
  outline: none;
}

.upload-zone.dragover {
  border-color: #4b85e6;
  background-color: #E8F0FF;
  box-shadow: 0 0 0 4px rgba(75, 133, 230, 0.12);
}

.upload-icon {
  width: 56px;
  height: 56px;
  color: #4b85e6;
  margin-bottom: 16px;
}

.upload-heading {
     margin: 0 0 6px;
    font-size: 22px !important;
    font-weight: 600 !important;
    color: #1F2937;
}

.upload-instruction {
  margin: 0 0 22px;
  color: #64748B;
  font-size: 15px;
  max-width: 420px;
}

.file-type-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: #64748B;
}

/* ===== Buttons ===== */
.btn {
 display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 8px !important;
    padding: 12px 20px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
    line-height: 1.2;
}

.btn:focus-visible {
  outline: 3px solid rgba(75, 133, 230, 0.5);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(75, 133, 230, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(75, 133, 230, 0.35);
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-ghost {
  background-color: #FFFFFF;
  color: #4b85e6;
  border-color: #CBD5E1;
}

.btn-ghost:hover:not(:disabled) {
  background-color: #F0F5FF;
  border-color: #4b85e6;
}

.btn-add {
  padding: 10px 16px;
  font-size: 14px;
}

.btn-danger {
  background-color: #FFFFFF;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-danger:hover {
  background-color: #FEF2F2;
  border-color: #DC2626;
}

/* ===== Upload actions ===== */
.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* ===== File list ===== */
.file-list {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-list-convert {
  margin-top: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background-color: #FFFFFF;
  border: 1px solid #E3E8F4;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.file-item:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.1);
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
}

.file-icon svg {
  width: 22px;
  height: 22px;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  margin: 0 !important;
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
 margin: 0 !important;
    font-size: 13px;
    color: #64748B;
}

.file-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background-color: #DCFCE7;
  color: #16A34A;
}

.file-tag.tag-fail {
  background-color: #FEE2E2;
  color: #DC2626;
}

.file-tag.tag-pending {
  background-color: #E3E8F4;
  color: #64748B;
}

.remove-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #E3E8F4;
  background-color: #FFFFFF;
  color: #64748B;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.remove-btn:hover {
  background-color: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.remove-btn:focus-visible {
  outline: 3px solid rgba(75, 133, 230, 0.5);
  outline-offset: 2px;
}

.remove-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== Convert section ===== */
.section-heading {
     margin: 0 0 6px;
    font-size: 22px !important;
    font-weight: 600 !important;
    color: #1F2937;
    text-align: center;
}

.section-sub {
  margin: 0 0 20px;
  text-align: center;
  color: #64748B;
  font-size: 15px;
}

.convert-actions {
  margin-top: 16px;
}

.convert-cta {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.btn-convert {
  padding: 16px 32px;
  font-size: 16px;
}

/* ===== Inline messages ===== */
.inline-error,
.inline-info {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.inline-error {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.inline-info {
  background-color: #F0F5FF;
  color: #4b85e6;
  border: 1px solid #C7D7F5;
}

/* ===== Loading ===== */
.loading-card {
  text-align: center;
  padding: 48px 32px;
}

.loading-illustration {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 24px;
}

.doc-icon {
  position: absolute;
  width: 64px;
  height: 64px;
  top: 16px;
  left: 16px;
}

.doc-icon-back {
  animation: docPulse 2.4s ease-in-out infinite;
}

.doc-icon-front {
  animation: docSpin 3.2s linear infinite;
  transform-origin: 48px 48px;
}

.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #4b85e6;
  opacity: 0;
}

.spark-1 {
  top: 8px;
  right: 6px;
  animation: sparkBlink 1.6s ease-in-out infinite;
}

.spark-2 {
  bottom: 10px;
  left: 4px;
  background-color: #9CA1E2;
  animation: sparkBlink 1.6s ease-in-out infinite 0.8s;
}

.loading-heading {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: #1F2937;
}

.loading-sub {
  margin: 0 0 24px;
  color: #64748B;
  font-size: 15px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.progress-track {
  width: 100%;
  max-width: 460px;
  height: 10px;
  background-color: #E3E8F4;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-track.indeterminate .progress-fill {
  width: 35%;
  animation: indeterminateSlide 1.6s ease-in-out infinite;
}

.progress-status {
  margin: 14px 0 0;
  font-size: 14px;
  color: #64748B;
}

/* ===== Results ===== */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results-card {
  padding: 36px;
}

.results-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #DCFCE7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.results-check svg {
  width: 34px;
  height: 34px;
}

.results-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background-color: #FFFFFF;
  border: 1px solid #E3E8F4;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.07);
  flex-wrap: wrap;
}

.result-info {
  flex: 1;
  min-width: 180px;
}

.result-name {
  margin: 0 !important;
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-orig {
  margin: 4px 0 0 !important;
  font-size: 13px;
  color: #64748B;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #16A34A;
  background-color: #DCFCE7;
  padding: 3px 10px;
  border-radius: 999px;
}

.result-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #16A34A;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Download button (primary CTA) */
.btn-download {
background: linear-gradient(135deg, #9CA1E2 0%, #4b85e6 50%, #9CA1E2 100%);
    color: #FFFFFF !important;
    border-radius: 10px !important;
    padding: 14px 24px;
    font-weight: 600 !important;
    font-size: 15px !important;
    border: none;
    box-shadow: 0 6px 18px rgba(75, 133, 230, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.2s;
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(75, 133, 230, 0.35);
}

.btn-download:focus-visible {
  outline: 3px solid rgba(75, 133, 230, 0.5);
  outline-offset: 2px;
}

/* Icon buttons (save / copy / delete) */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #E3E8F4;
  background-color: #FFFFFF;
  color: #4b85e6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  position: relative;
}

.icon-btn:hover {
  background-color: #F0F5FF;
  border-color: #4b85e6;
  transform: translateY(-1px);
}

.icon-btn:focus-visible {
  outline: 3px solid rgba(75, 133, 230, 0.5);
  outline-offset: 2px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.danger {
  color: #DC2626;
}

.icon-btn.danger:hover {
  background-color: #FEF2F2;
  border-color: #DC2626;
}

/* Tooltip */
.icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #1F2937;
  color: #FFFFFF;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 10;
}

.icon-btn[data-tooltip]:hover::after,
.icon-btn[data-tooltip]:focus-visible::after {
  opacity: 1;
}

.result-retry {
  margin-top: 10px;
}

/* ===== Results footer ===== */
.results-footer {
  display: flex;
  justify-content: center;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(31, 41, 55, 0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background-color: #16A34A;
}

.toast-error {
  background-color: #DC2626;
}

.toast-info {
  background-color: #4b85e6;
}

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .doc-icon-back,
  .doc-icon-front,
  .spark-1,
  .spark-2,
  .progress-track.indeterminate .progress-fill {
    animation: none !important;
  }
  .progress-fill,
  .btn,
  .icon-btn,
  .btn-download {
    transition: none !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #app {
    padding: 16px 14px 48px;
  }
  .main-header {
    padding: 22px 16px;
  }
  .main-header h1 {
    font-size: 22px;
  }
  .card {
    padding: 22px 18px;
  }
  .upload-zone {
    padding: 28px 16px;
  }
  .upload-heading {
    font-size: 19px;
  }
  .upload-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .upload-actions .btn {
    width: 100%;
  }
  .step-connector {
    width: 16px;
  }
  .step {
    padding: 6px 10px;
    font-size: 13px;
  }
  .results-card {
    padding: 24px 18px;
  }
  .result-item {
    flex-direction: column;
    align-items: stretch;
  }
  .result-actions {
    width: 100%;
    justify-content: space-between;
  }
  .btn-download {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .step-label {
    display: none;
  }
  .step-connector {
    width: 10px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
}
