.apf-dz-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 620px;
  margin: 0 auto;
}
.apf-dz-root *,
.apf-dz-root *::before,
.apf-dz-root *::after {
  box-sizing: border-box;
}

.apf-dz-header {
  margin-bottom: 16px;
}
.apf-dz-header h3 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}
.apf-dz-header p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.apf-dz-zone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 14px;
  background: #fafbfc;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.apf-dz-zone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
.apf-dz-zone.dz-dragover {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.apf-dz-zone.dz-has-file {
  border-style: solid;
  border-color: #e4e7ec;
  background: #fff;
  cursor: default;
  padding: 20px;
}
.apf-dz-zone.dz-has-file:hover {
  border-color: #d0d5dd;
  background: #fff;
}
.apf-dz-zone.dz-uploading {
  pointer-events: none;
}

.apf-dz-upload .dz-icon {
  display: block;
  margin: 0 auto 12px;
  width: 48px;
  height: 48px;
  color: #9ca3af;
  transition: color 0.2s;
}
.apf-dz-zone:hover .dz-icon,
.apf-dz-zone.dz-dragover .dz-icon {
  color: #2563eb;
}
.apf-dz-upload .dz-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.apf-dz-upload .dz-sub {
  display: block;
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 14px;
}
.apf-dz-upload .dz-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.apf-dz-upload .dz-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  padding: 4px 11px;
}
.apf-dz-upload .dz-pill svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.apf-dz-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.apf-dz-zone.dz-has-file .apf-dz-preview {
  display: flex;
}
.apf-dz-zone.dz-has-file .apf-dz-upload {
  display: none;
}

.apf-dz-zone.dz-has-file .apf-dz-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #eef2ff;
  border-radius: 12px;
  color: #4f46e5;
  margin-bottom: 10px;
}
.apf-dz-zone.dz-has-file .apf-dz-file-icon svg {
  width: 28px;
  height: 28px;
}
.apf-dz-filename {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  word-break: break-all;
  text-align: center;
  margin-bottom: 4px;
}
.apf-dz-filesize {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 12px;
}
.apf-dz-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.apf-dz-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
  position: relative;
}
.apf-dz-zone.dz-uploading .apf-dz-loading {
  display: flex;
}
.apf-dz-zone.dz-uploading .apf-dz-preview,
.apf-dz-zone.dz-uploading .apf-dz-upload {
  display: none;
}

/* ── AI neural orb ─────────────────────────────── */
.dz-ai-orb {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.dz-ai-orb-core {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.4), 0 0 60px rgba(124, 58, 237, 0.2);
  animation: dz-orb-pulse 2s ease-in-out infinite;
}
.dz-ai-orb-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.15);
  animation: dz-ring-expand 2.5s ease-out infinite;
}
.dz-ai-orb-ring:nth-child(2) {
  animation-delay: 0.8s;
}
.dz-ai-orb-ring:nth-child(3) {
  animation-delay: 1.6s;
}
@keyframes dz-orb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}
@keyframes dz-ring-expand {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── AI message ────────────────────────────────── */
.dz-ai-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 52px;
}
.dz-ai-message-text {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  transition: opacity 0.3s;
}
.dz-ai-message-sub {
  font-size: 12px;
  color: #9ca3af;
  transition: opacity 0.3s;
}

/* ── Thinking dots ─────────────────────────────── */
.dz-ai-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-left: 2px;
}
.dz-ai-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2563eb;
  animation: dz-dot-bounce 1.4s ease-in-out infinite;
}
.dz-ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.dz-ai-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dz-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ── Floating particles ────────────────────────── */
.dz-ai-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.dz-ai-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  opacity: 0;
  animation: dz-particle-float 4s ease-in-out infinite;
}
.dz-ai-particle:nth-child(1) { left: 20%; animation-delay: 0s; }
.dz-ai-particle:nth-child(2) { left: 50%; animation-delay: 1s; }
.dz-ai-particle:nth-child(3) { left: 75%; animation-delay: 2s; }
.dz-ai-particle:nth-child(4) { left: 35%; animation-delay: 0.5s; }
.dz-ai-particle:nth-child(5) { left: 65%; animation-delay: 1.5s; }
.dz-ai-particle:nth-child(6) { left: 85%; animation-delay: 2.5s; }
.dz-ai-particle:nth-child(7) { left: 10%; animation-delay: 0.8s; }
.dz-ai-particle:nth-child(8) { left: 90%; animation-delay: 2.2s; }
@keyframes dz-particle-float {
  0% { transform: translateY(30px) scale(0); opacity: 0; }
  20% { opacity: 0.6; transform: translateY(10px) scale(1); }
  80% { opacity: 0.6; transform: translateY(-60px) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0); }
}

/* ── Animated gradient progress ────────────────── */
.apf-dz-progress-fill {
  background: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb);
  background-size: 200% 100%;
  animation: dz-grad-shift 2s linear infinite;
}
@keyframes dz-grad-shift {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ── Glow overlay during processing ────────────── */
.apf-dz-zone.dz-uploading::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.03), rgba(124, 58, 237, 0.03));
  pointer-events: none;
  z-index: 1;
}

.apf-dz-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.3;
}
.apf-dz-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
.apf-dz-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.apf-dz-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.apf-dz-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.apf-dz-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.apf-dz-btn--danger {
  color: #dc2626;
}
.apf-dz-btn--danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.apf-dz-progress {
  display: none;
  margin-top: 16px;
}
.apf-dz-progress.dz-visible {
  display: block;
}
.apf-dz-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.apf-dz-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.apf-dz-progress-text {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.apf-dz-result {
  display: none;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.apf-dz-result.dz-visible {
  display: block;
}
.apf-dz-result--success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.apf-dz-result--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.apf-dz-result a {
  color: inherit;
}

.apf-dz-toast {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.apf-dz-toast.dz-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.apf-dz-toast--error {
  background: #dc2626;
  color: #fff;
}
.apf-dz-toast--success {
  background: #059669;
  color: #fff;
}

.apf-dz-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, 0.04);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4;
  border-radius: 14px;
  pointer-events: none;
}
.apf-dz-zone.dz-dragover .apf-dz-drop-overlay {
  display: flex;
}
.apf-dz-drop-overlay span {
  padding: 10px 22px;
  background: #2563eb;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

/* ── Status area (preview + complete) ──────────── */
.apf-dz-status {
  display: none;
  margin-top: 8px;
  width: 100%;
}
.apf-dz-status:not(:empty) {
  display: block;
}

.apf-dz-preview-wrap,
.apf-dz-complete-wrap {
  animation: dz-fade-in 0.35s ease;
}
@keyframes dz-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Preview cards ─────────────────────────────── */
.apf-dz-preview-header {
  text-align: center;
  margin-bottom: 16px;
}
.apf-dz-preview-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  margin-bottom: 10px;
}
.apf-dz-preview-icon svg {
  width: 24px;
  height: 24px;
}
.apf-dz-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}
.apf-dz-preview-title strong {
  color: #2563eb;
}
.apf-dz-preview-sub {
  font-size: 13px;
  color: #9ca3af;
}
.apf-dz-preview-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.apf-dz-preview-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}
.apf-dz-pc-index {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 1px 7px;
  border-radius: 6px;
}
.apf-dz-pc-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 32px;
}
.apf-dz-pc-field {
  display: flex;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.apf-dz-pc-label {
  font-weight: 600;
  color: #6b7280;
  flex-shrink: 0;
  min-width: 60px;
}
.apf-dz-pc-value {
  color: #1f2937;
  word-break: break-word;
}
.apf-dz-preview-more {
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
  padding: 6px 0 14px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 14px;
}
.apf-dz-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.apf-dz-preview-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}
.apf-dz-preview-tip span {
  flex: 1;
}

/* ── Complete state ────────────────────────────── */
.apf-dz-zone.dz-complete {
  border-style: solid;
  border-color: #d1d5db;
  background: #fff;
  cursor: default;
  padding: 20px;
  min-height: auto;
}
.apf-dz-zone.dz-complete:hover {
  border-color: #d1d5db;
  background: #fff;
}
.apf-dz-zone.dz-complete .apf-dz-upload,
.apf-dz-zone.dz-complete .apf-dz-preview {
  display: none;
}
.apf-dz-complete-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  width: 100%;
}
.apf-dz-complete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.apf-dz-complete-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}
.apf-dz-complete-summary {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}
.apf-dz-complete-stats {
  display: flex;
  gap: 10px;
  margin: 2px 0 6px;
}
.apf-dz-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.apf-dz-stat--ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.apf-dz-stat--err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.apf-dz-stat--warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
.apf-dz-complete-detail {
  margin: 8px 0 0;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}
.apf-dz-complete-wrap .apf-dz-btn--primary {
  margin-top: 4px;
}

/* ── Admin debug JSON ──────────────────────────── */
.apf-dz-debug {
  margin-bottom: 12px;
}
.apf-dz-debug-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  width: 100%;
  justify-content: center;
}
.apf-dz-debug-toggle:hover {
  background: #e0e7ff;
}
.apf-dz-debug-toggle svg {
  transition: transform 0.2s;
}
.apf-dz-debug-toggle.dz-open svg {
  transform: rotate(90deg);
}
.apf-dz-debug-content {
  display: none;
  margin-top: 8px;
}
.apf-dz-debug-json {
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre;
  margin: 0 0 8px;
  scrollbar-width: thin;
}
.apf-dz-debug-json::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}
.apf-dz-debug-json::-webkit-scrollbar-track {
  background: #0f172a;
}
.apf-dz-debug-json::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
.apf-dz-debug-copy {
  font-size: 12px !important;
  padding: 5px 14px !important;
}

/* ── Link button ────────────────────────────────── */
.apf-dz-btn--link {
  background: none;
  border: none;
  color: #2563eb;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.apf-dz-btn--link:hover {
  color: #1d4ed8;
  background: none;
}
.apf-dz-btn--link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: #93c5fd;
}

/* ── Full JSON modal ────────────────────────────── */
.apf-dz-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
  animation: dz-fade-in 0.2s ease;
}
.apf-dz-modal {
  background: #fff;
  border-radius: 14px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.apf-dz-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.apf-dz-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}
.apf-dz-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.apf-dz-modal-close:hover {
  color: #374151;
}
.apf-dz-modal-json {
  flex: 1;
  overflow: auto;
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 16px 20px;
  margin: 0;
  white-space: pre;
  scrollbar-width: thin;
  min-height: 200px;
}
.apf-dz-modal-json::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.apf-dz-modal-json::-webkit-scrollbar-track {
  background: #0f172a;
}
.apf-dz-modal-json::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
.apf-dz-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .apf-dz-zone {
    padding: 24px 16px;
    min-height: 160px;
  }
  .apf-dz-zone.dz-complete {
    padding: 16px;
  }
  .apf-dz-upload .dz-icon {
    width: 40px;
    height: 40px;
  }
  .apf-dz-header h3 {
    font-size: 18px;
  }
  .apf-dz-pc-field {
    flex-direction: column;
    gap: 0;
  }
  .apf-dz-pc-label {
    min-width: auto;
    font-size: 11px;
    color: #9ca3af;
  }
}
