/* ==========================================================================
   PDFPrisma - Tool Components & Interactive Workspace Styles
   ========================================================================== */

/* Tool Workspace Container */
.tool-workspace {
  padding: 2.5rem 0 4rem;
  min-height: calc(100vh - var(--header-height) - 300px);
}

.tool-header {
  text-align: center;
  max-width: 750px;
  margin: 0 auto 2.5rem;
}

.tool-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tool-breadcrumb a:hover {
  color: var(--primary);
}

.tool-page-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.75rem;
}

.tool-page-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* Upload Dropzone */
.dropzone-container {
  max-width: 820px;
  margin: 0 auto;
}

.upload-dropzone {
  background: var(--bg-surface);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
  box-shadow: var(--shadow-lg);
}

.dropzone-icon {
  width: 76px;
  height: 76px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.upload-dropzone:hover .dropzone-icon, .upload-dropzone.dragover .dropzone-icon {
  transform: translateY(-4px) scale(1.05);
}

.dropzone-icon svg {
  width: 38px;
  height: 38px;
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dropzone-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.btn-upload {
  background: var(--grad-primary);
  color: white;
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-upload:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.privacy-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.privacy-notice svg {
  width: 16px;
  height: 16px;
  color: var(--success);
}

/* Hidden File Input */
.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ==========================================================================
   Tool Work Area (Files Uploaded State)
   ========================================================================== */
.work-area {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.work-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.work-area-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 1.25rem;
}

/* Página 404 */
.notfound-code {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* Aviso legal */
.legal-text a {
  color: var(--primary);
  text-decoration: underline;
}

.legal-owner-list {
  list-style: none;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.legal-pending {
  color: var(--danger, #DC2626);
  font-style: italic;
}

/* Formulario de contacto */
.contact-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.contact-privacy {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.contact-privacy a {
  color: var(--primary);
  text-decoration: underline;
}

.contact-status {
  text-align: center;
  font-weight: 600;
  font-size: 0.92rem;
  min-height: 1.4em;
}

.contact-status-success {
  color: var(--success, #10B981);
}

.contact-status-error {
  color: var(--danger, #DC2626);
}

/* Botón "Volver" para regresar a la selección de archivo */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.file-count-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.85rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.work-actions {
  display: flex;
  gap: 0.75rem;
}

/* File Cards Grid (For Sorting / Managing Files) */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.file-card {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}

.file-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.file-thumb-box {
  width: 100%;
  height: 160px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

.file-thumb-box canvas, .file-thumb-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-thumb-fallback {
  color: var(--primary);
}

.file-thumb-fallback svg {
  width: 48px;
  height: 48px;
}

.file-meta {
  flex-grow: 1;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.file-details {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-card-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-card-action:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.btn-card-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.btn-card-action svg {
  width: 16px;
  height: 16px;
}

/* Add More Card */
.add-more-card {
  border: 2px dashed var(--border-color);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  gap: 0.75rem;
}

.add-more-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.add-more-card svg {
  width: 32px;
  height: 32px;
}

/* ==========================================================================
   Tool Options & Settings Panel
   ========================================================================== */
.tool-options-panel {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.options-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.radio-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.radio-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.radio-card input {
  display: none;
}

.radio-card:hover {
  border-color: var(--primary);
}

.radio-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.radio-card-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.radio-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.radio-card-estimate {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.radio-card-estimate strong {
  color: var(--primary);
  font-weight: 800;
}

/* Barra de ajuste del peso final (Comprimir PDF) */
.compress-slider {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.compress-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.compress-slider-value {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
}

.compress-slider input[type="range"] {
  width: 100%;
  margin: 0.75rem 0 0.4rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.compress-slider input[type="range"]:disabled {
  cursor: wait;
  opacity: 0.5;
}

.compress-slider-scale {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.compress-slider-scale #sliderQuality {
  font-weight: 600;
  color: var(--text-main);
}

.compress-slider-note {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Tool Action Bar (Bottom Floating / Sticky Bar)
   ========================================================================== */
.tool-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn-execute {
  background: var(--grad-primary);
  color: white;
  padding: 0.9rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition);
}

.btn-execute:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-execute:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   Processing Overlay & Modal
   ========================================================================== */
.processing-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.processing-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.processing-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Result Success View
   ========================================================================== */
.result-view {
  display: none;
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 650px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}

.result-icon-check {
  width: 80px;
  height: 80px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.result-icon-check svg {
  width: 44px;
  height: 44px;
}

.result-title {
  font-size: 1.85rem;
  margin-bottom: 0.5rem;
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.result-download-btn {
  background: var(--grad-primary);
  color: white;
  padding: 1rem 3rem;
  font-size: 1.15rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--primary-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition);
  text-decoration: none;
  margin-bottom: 1.5rem;
}

.result-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--primary-glow);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideLeft 0.3s ease;
}

@keyframes slideLeft {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-success {
  border-left: 4px solid var(--success);
}

/* ==========================================================================
   File Card Drag & Drop Handle & Red Delete Button
   ========================================================================== */
.file-card-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.65rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: var(--transition);
}

.file-card-drag-handle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

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

.file-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.2);
}

.file-card.drag-over {
  border: 2px dashed var(--primary);
  background: var(--primary-light);
}

/* Delete Button Only (Trash in Red) */
.btn-card-delete-only {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #EF4444;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
}

.btn-card-delete-only:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

/* ==========================================================================
   Work Area Summary Bar (Total Pages & Final Combined Size)
   ========================================================================== */
.work-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.summary-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.summary-value {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.05rem;
}

[hidden] {
  display: none !important;
}

/* Dividir PDF: resumen, etiquetas de archivo por página y lista de resultados */
.split-summary {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.split-summary.is-error {
  color: var(--danger, #DC2626);
}

.page-part-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
}

.page-preview-card.excluded {
  opacity: 0.4;
}

.page-preview-card.excluded .page-part-badge {
  background: var(--text-muted);
}

.split-files-list {
  max-width: 560px;
  margin: 0 auto 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.split-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.split-file-name {
  font-weight: 600;
  font-size: 0.9rem;
  word-break: break-all;
}

.split-file-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.split-file-row .btn-secondary {
  flex-shrink: 0;
}

/* Resumen del archivo generado en la vista de resultado */
.result-info-bar {
  justify-content: center;
  gap: 1rem 2.5rem;
  max-width: 560px;
  margin: 0 auto 2rem;
}

/* ==========================================================================
   Next Actions Grid (Post-processing Workflow Chaining)
   ========================================================================== */
.next-actions-container {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: left;
}

.next-actions-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  text-align: center;
}

.next-actions-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.next-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.next-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-main);
  transition: var(--transition);
  cursor: pointer;
}

.next-action-card:hover {
  border-color: var(--primary);
  background: var(--bg-surface);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.next-action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.next-action-label {
  font-size: 0.92rem;
  font-weight: 700;
}

/* ==========================================================================
   Homepage Processed Stats Counter
   ========================================================================== */
.stats-counter-section {
  margin: 1.5rem auto 2.5rem;
  max-width: 900px;
}

.stats-counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stats-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stats-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.stats-card-number {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.stats-card-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}
