/* ============================================================
   TRADESALA TOOLSPOT — SPLIT PDF SPECIFIC STYLES
   ============================================================ */

.tool-header {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 900px;
  margin: 0 auto 40px auto;
}

.tool-layout {
  display: flex;
  justify-content: center;
  margin: 0 auto !important;
  max-width: 900px;
  width: 100%;
}

.p2w-panel {
  width: 100%;
  padding: 40px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

/* ── INTEGRATED FOOTER CONTROLS ── */
.editor-footer-controls {
  margin-top: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  display: flex;
  align-items: center;
}

.summary-inline {
  font-size: 13px;
  color: var(--text-2);
  margin-right: 20px;
}

.summary-inline .hl {
  color: var(--red);
  font-weight: 800;
}

.footer-right {
  display: flex;
  align-items: center;
}

@media (max-width: 800px) {
  .editor-footer-controls {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
  }
  .footer-left {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  #extract-options {
    margin-left: 0 !important;
  }
  #extract-options input {
    width: 100% !important;
  }
  .footer-right {
    flex-direction: column;
    gap: 15px;
  }
  .summary-inline {
    margin-right: 0;
  }
  .footer-right .rb-btn {
    width: 100%;
  }
}

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

.p2w-dropzone, .loading-view, .split-editor, .success-panel {
  grid-area: 1 / 1 / 2 / 2;
  transition: opacity 0.3s ease;
  width: 100%;
  opacity: 0;
  display: none;
  will-change: opacity;
}

/* ── 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;
}

/* ── ELITE LOADER ── */
.loading-view {
  padding: 80px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loader-percentage {
  font-family: 'Outfit', sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -2px;
  animation: pulseOpacity 2s infinite ease-in-out;
}

#load-status {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 30px;
}

.elite-progress-container {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin: 0 auto; /* Added for perfect centering */
}

.elite-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), #f97316);
  box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
  width: 0%;
  transition: width 0.3s ease;
}

.shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmerMove 1.5s infinite;
}

@keyframes shimmerMove {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── VIEW TRANSITIONS ── */
.view-active {
  display: block !important;
  opacity: 1 !important;
  z-index: 2;
  animation: viewEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.is-leaving {
  display: block !important;
  opacity: 0 !important;
  z-index: 1;
  position: absolute;
  pointer-events: none;
  animation: viewExit 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes viewEnter {
  from { opacity: 0; transform: scale(0.98) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes viewExit {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(1.02) translateY(-10px); }
}

/* ── PAGE GRID ── */
.split-editor {
  display: none;
  flex-direction: column;
}

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

.mode-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 12px;
  position: relative;
  border: 1px solid var(--glass-border);
}

.mode-btn {
  padding: 8px 20px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
}

.mode-btn.active {
  color: #fff;
}

.mode-glider {
  position: absolute;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: var(--red);
  border-radius: 8px;
  top: 4px;
  left: 4px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.mode-btn[data-mode="burst"].active ~ .mode-glider {
  transform: translateX(100%);
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  max-height: 600px;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.page-grid::-webkit-scrollbar {
  width: 6px;
}

.page-grid::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}

.page-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.page-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.page-item.selected {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}

.page-thumb-container {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  background: #1e1e2e;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.page-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-number {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
}

.page-item.selected .page-number {
  color: var(--red);
}

.selection-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.4);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-item.selected .selection-badge {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: scale(1.1);
}

/* ── SUCCESS PANEL ── */
.success-panel {
  text-align: center;
  padding: 40px 0;
}

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

.success-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

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

.success-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.privacy-badge {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
  background: rgba(255,255,255,0.03);
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.05);
  display: inline-block;
}

/* ── RANGE SELECTOR ── */
#extract-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 20px;
  padding-left: 20px;
  border-left: 1px solid var(--glass-border);
}

#extract-options label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#extract-options input {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  width: 120px;
  outline: none;
  transition: all 0.2s;
}

#extract-options input:focus {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.05);
}
