/* ============================================================
   TRADESALA TOOLSPOT — PDF TO WORD SPECIFIC STYLES
   ============================================================ */

.tool-layout {
  display: flex;
  justify-content: center;
  /* Centers the child panel perfectly */
  margin: 0 auto !important;
  max-width: 900px;
  /* Reduced from 1600px for a tighter, focused dropzone */
  width: 100%;
}

.tool-header {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: left;
  max-width: 900px;
  margin: 0 auto 40px auto;
  /* Centers the header block and adds bottom spacing */
}

.p2w-panel {
  width: 100%;
  /* Forces the panel to respect the 900px max-width of its parent */
  padding: 40px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

/* ── DROPZONE ── */
.p2w-dropzone {
  width: 100% !important;
  box-sizing: border-box;
  border: 2px dashed var(--glass-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  padding: 60px 20px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.p2w-dropzone:hover,
.p2w-dropzone.drag-over {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--red);
  transform: translateY(-2px);
}

.p2w-dropzone.drag-over::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(249, 115, 22, 0.05);
  pointer-events: none;
}

.drop-icon {
  font-size: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 20px rgba(249, 115, 22, 0.2));
  transition: transform 0.3s ease;
}

/* ── GLASS BUTTONS ── */
.rb-btn {
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text) !important;
  padding: 14px 36px !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.rb-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.rb-btn-primary {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
  color: var(--red) !important;
}

.rb-btn-primary:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: var(--red) !important;
}

.p2w-dropzone h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.p2w-dropzone p {
  color: var(--text-3);
  margin-bottom: 30px;
}



/* ── QUEUE LIST ── */
.p2w-queue {
  margin-top: 40px;
  animation: fadeIn 0.5s ease both;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
}

.queue-header h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
}

.queue-actions {
  display: flex;
  gap: 10px;
}

.rb-btn-small {
  padding: 8px 16px;
  font-size: 11px;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── QUEUE ITEM ── */
.queue-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.drag-handle {
  cursor: grab;
  font-size: 18px;
  color: var(--text-3);
  padding: 5px;
  opacity: 0.5;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.queue-item:hover .drag-handle {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

/* SortableJS Classes */
.sortable-ghost {
  opacity: 0.4;
  background: rgba(249, 115, 22, 0.1);
  border: 1px dashed var(--red);
}

.sortable-drag {
  cursor: grabbing !important;
  opacity: 1 !important;
  background: var(--glass-bg) !important;
  border-color: var(--red) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.q-icon {
  font-size: 24px;
  width: 40px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.q-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

/* Elite Progress Bar */
.merge-progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-top: 15px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.merge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), #ff9a9e);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.q-remove-btn {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--red);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.q-remove-btn:hover {
  background: rgba(255, 0, 0, 0.1);
  border-color: var(--red);
  transform: scale(1.05);
}

/* Custom Filename Input */
.custom-filename-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 10px;
  margin-right: 15px;
  transition: border-color 0.2s;
}

.custom-filename-wrap:focus-within {
  border-color: var(--red);
}

.custom-filename-input {
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font-family);
  font-size: 14px;
  padding: 10px 0;
  width: 180px;
  outline: none;
}

.file-extension {
  color: var(--text-3);
  font-size: 14px;
  user-select: none;
}

.bulk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.q-info {
  flex: 1;
  min-width: 0;
}

.q-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.q-status {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-download {
  margin-left: 10px;
  z-index: 10;
}

.status-pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-3);
}

.status-converting {
  background: rgba(249, 115, 22, 0.1);
  color: var(--red);
  animation: pulse 1.5s infinite;
}

.status-done {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.status-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ── PROGRESS BAR (Inline) ── */
.q-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--red);
  transition: width 0.3s ease;
}

/* ── BULK FOOTER ── */
.bulk-footer {
  margin-top: 30px;
  padding: 20px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideUp 0.4s ease both;
}

.bulk-status {
  font-weight: 600;
  color: #10b981;
}

/* ── ANIMATIONS ── */
@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .p2w-panel {
    padding: 20px;
  }

  .queue-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .bulk-footer {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
}

/* ── SUCCESS PANEL ── */
.success-panel {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Switched to pure fade to prevent 'falling' jumpiness */
  animation: appleFadeIn 0.5s cubic-bezier(0.19, 1, 0.22, 1) both;
}

@keyframes appleFadeIn {
  from {
    opacity: 0;
    filter: blur(10px);
  }

  to {
    opacity: 1;
    filter: blur(0);
  }
}

.success-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon {
  font-size: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 20px rgba(249, 115, 22, 0.3));
}

.success-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
  text-align: center;
}

.success-content p {
  color: var(--text-2);
  margin-bottom: 32px;
  text-align: center;
}

.success-footer {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(10px);
}

.custom-filename-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0 18px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 400px;
  transition: all 0.3s ease;
}

.custom-filename-wrap:focus-within {
  border-color: var(--red);
  background: rgba(249, 115, 22, 0.05);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.custom-filename-input {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 14px 0;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  outline: none;
}

.file-extension {
  color: var(--text-3);
  font-weight: 700;
  font-size: 14px;
  margin-left: 8px;
}

/* ── MOBILE POLISH ── */
@media (max-width: 640px) {
  .queue-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .queue-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .queue-actions .rb-btn:last-child {
    grid-column: span 2;
  }

  .queue-item {
    padding: 12px;
    gap: 10px;
  }

  .q-info {
    flex: 1;
  }

  .q-name {
    font-size: 13px;
    max-width: 120px;
  }

  .q-meta {
    display: none;
  }

  .q-status {
    font-size: 10px;
    padding: 2px 6px;
  }

  .success-content h2 {
    font-size: 22px;
  }

  .success-footer {
    padding: 24px;
  }

  .success-actions {
    flex-direction: column;
    width: 100%;
  }

  .success-actions .rb-btn {
    width: 100%;
  }

  .custom-filename-wrap {
    max-width: 100%;
  }
}

/* ── QUEUE ITEM POLISH ── */
.q-info {
  flex: 1;
  min-width: 0;
}

.q-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.q-meta {
  font-size: 12px;
  color: var(--text-3);
}

.q-status {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-ready {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.status-loading {
  color: var(--red2);
  animation: pulse 1.5s infinite;
}

.status-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ── WORKBENCH TRANSITIONS (Grid Stack) ── */
.workbench-container {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 100%;
  min-height: 350px;
}

.p2w-dropzone,
.p2w-queue,
.success-panel {
  grid-area: 1 / 1 / 2 / 2;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  background: transparent;
  will-change: opacity;
  opacity: 0;
  display: none;
}

/* State when a view is fading out - take it out of flow so it doesn't affect height */
.is-leaving {
  position: absolute !important;
  top: 0;
  left: 0;
  z-index: 1;
}

/* State when a view is fading in/active */
.view-active {
  display: block !important;
  opacity: 1 !important;
  z-index: 2;
}

.success-panel {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ensure hidden views don't capture clicks */
div[style*="display: none"] {
  pointer-events: none;
}

/* Remove margins that could cause shifts */
.p2w-queue {
  margin-top: 0 !important;
}

/* ── LIGHT MODE OVERRIDES ── */
body.light .success-footer {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light .custom-filename-wrap {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light .custom-filename-input {
  color: #000000;
}

body.light .success-content h2 {
  color: #000000;
}

body.light .success-content p {
  color: #334155;
}

body.light .file-extension {
  color: #64748b;
}

body.light .q-name {
  color: #000000;
}

body.light .queue-item {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

body.light .queue-item:hover {
  background: #f8fafc;
}