:root {
  color-scheme: light;
  --ilove-red: #e5322b;
  --ilove-red-hover: #c8231c;
  --ilove-bg: #f7f7f9;
  --ilove-card-bg: #ffffff;
  --ilove-text: #161616;
  --ilove-text-muted: #666666;
  --ilove-border: #e0e0e0;
  --ilove-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  --ilove-radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--ilove-bg);
  color: var(--ilove-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar estilo iLovePDF */
.ilove-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--ilove-border);
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  background: var(--ilove-red);
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-red {
  color: var(--ilove-red);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0f0f2;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #444;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: #e4e4e8;
  color: #000;
}

/* Main Container */
.ilove-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
}

/* HERO DROPZONE (Estado Inicial) */
.hero-section {
  text-align: center;
  max-width: 760px;
  margin: 20px auto 0;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--ilove-text-muted);
  margin: 0 0 40px;
  line-height: 1.5;
}

.ilove-dropzone {
  background: #ffffff;
  border: 3px dashed #d0d0d5;
  border-radius: 24px;
  padding: 60px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  cursor: pointer;
  box-shadow: var(--ilove-shadow);
}

.ilove-dropzone:hover,
.ilove-dropzone.is-dragover {
  border-color: var(--ilove-red);
  background: #fff8f8;
  transform: translateY(-2px);
}

.btn-ilove-select {
  background: var(--ilove-red);
  color: #ffffff;
  border: none;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 20px 48px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(229, 50, 43, 0.3);
  transition: all 0.2s ease;
}

.btn-ilove-select:hover {
  background: var(--ilove-red-hover);
  transform: scale(1.03);
  box-shadow: 0 12px 28px rgba(229, 50, 43, 0.4);
}

.dropzone-hint {
  margin: 20px 0 0;
  font-size: 0.95rem;
  color: var(--ilove-text-muted);
}

.dropzone-badge {
  display: inline-block;
  margin-top: 14px;
  background: #edf8f2;
  color: #0f8a48;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
}

/* WORKSPACE LAYOUT (Estado 2: Al cargar archivos) */
.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.workspace-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid var(--ilove-border);
  box-shadow: var(--ilove-shadow);
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ilove-border);
  flex-wrap: wrap;
  gap: 16px;
}

.header-titles h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  font-weight: 800;
}

.search-bar input {
  padding: 8px 14px;
  border: 1px solid var(--ilove-border);
  border-radius: 10px;
  font-size: 0.9rem;
  width: 260px;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--ilove-red);
}

.workspace-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-add-more {
  background: #f0f0f4;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-add-more:hover {
  background: #e2e2e8;
}

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--ilove-red);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

/* GRID DE TARJETAS AL ESTILO ILOVEPDF */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  min-height: 240px;
}

.rtf-card {
  background: #fdfdfd;
  border: 1px solid #e8e8ed;
  border-radius: 14px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
}

.rtf-card:hover {
  border-color: var(--ilove-red);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.rtf-card-icon {
  width: 48px;
  height: 58px;
  background: #ffebeb;
  border: 2px solid #ffcccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ilove-red);
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 12px;
  position: relative;
}

.rtf-card-icon::after {
  content: "RTF";
  position: absolute;
  bottom: 4px;
  font-size: 0.65rem;
  font-weight: 900;
}

.rtf-card-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #222;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 4px;
}

.rtf-card-size {
  font-size: 0.72rem;
  color: var(--ilove-text-muted);
}

.rtf-card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: 50%;
  color: #666;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.rtf-card:hover .rtf-card-remove {
  opacity: 1;
}

.rtf-card-remove:hover {
  background: var(--ilove-red);
  color: #fff;
}

/* SIDEBAR Y BOTONAZO REDONDO CONVERTIR */
.workspace-sidebar {
  position: sticky;
  top: 90px;
}

.sidebar-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--ilove-border);
  box-shadow: var(--ilove-shadow);
}

.sidebar-card h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 800;
}

.summary-stats {
  background: #f8f8fa;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: #555;
}

.stat-row strong {
  color: #000;
}

.text-success strong { color: #0f8a48; }
.text-warning strong { color: #d97706; }

.sidebar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--ilove-border);
  background: #fff;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.btn-ilove-convert {
  width: 100%;
  background: var(--ilove-red);
  color: #ffffff;
  border: none;
  padding: 18px;
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(229, 50, 43, 0.35);
  transition: all 0.2s ease;
}

.btn-ilove-convert:hover:not(:disabled) {
  background: var(--ilove-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(229, 50, 43, 0.45);
}

.btn-ilove-convert:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* PAGINADOR EN WORKSPACE */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ilove-border);
  font-size: 0.85rem;
  color: var(--ilove-text-muted);
}

.btn-page {
  background: #f0f0f2;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* MODAL PROGRESO (Overlay al convertir) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  width: min(480px, 90%);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.modal-large {
  width: min(800px, 90%);
  text-align: left;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #ffebeb;
  border-top-color: var(--ilove-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.ilove-progress-bar {
  height: 12px;
  background: #f0f0f4;
  border-radius: 999px;
  overflow: hidden;
  margin: 20px 0 8px;
}

.ilove-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ilove-red);
  transition: width 0.2s ease;
}

.modal-percent {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ilove-red);
}

/* PANTALLA DE ÉXITO ESTILO ILOVEPDF */
.success-section {
  text-align: center;
  max-width: 680px;
  margin: 30px auto;
}

.success-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 48px;
  border: 1px solid var(--ilove-border);
  box-shadow: var(--ilove-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  background: #edf8f2;
  color: #0f8a48;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.btn-ilove-download {
  background: var(--ilove-red);
  color: #ffffff;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 20px 40px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(229, 50, 43, 0.35);
  margin-bottom: 20px;
}

.btn-ilove-download:hover {
  background: var(--ilove-red-hover);
  transform: scale(1.02);
}

.secondary-downloads {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.btn-sec-download {
  background: #f0f0f4;
  color: #333;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-sec-download:hover {
  background: #e2e2e8;
}

.btn-restart {
  background: transparent;
  border: none;
  color: var(--ilove-text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-restart:hover {
  color: #000;
}

/* MODAL BOARD TABLE */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ilove-border);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-body {
  overflow-y: auto;
  padding-top: 16px;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.board-table th, .board-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ilove-border);
  text-align: left;
}

.text-danger {
  color: #dc2626 !important;
}

.btn-tab-danger {
  color: #dc2626 !important;
}

.btn-tab-danger:hover,
.btn-tab-danger.active {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

.unregistered-banner {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 12px 20px;
  margin: 16px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 580px;
  width: 100%;
}

.unregistered-banner-text {
  font-size: 0.92rem;
  color: #9f1239;
}

.btn-view-unregistered {
  background: #be123c;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.btn-view-unregistered:hover {
  background: #9f1239;
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 2000;
}
