/**
 * Estilos canónicos para Conversor de PDF a Word (.docx)
 * Fijate Tools • fijate.com
 */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema claro por defecto */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dimmed: #64748b;

  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-border: #bfdbfe;

  --success-color: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning-color: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger-color: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Tema oscuro */
[data-theme="dark"], body.dark-theme {
  --bg-page: #0b0f19;
  --bg-card: #111827;
  --bg-card-subtle: #1f2937;
  --border-color: #374151;
  --border-focus: #3b82f6;

  --text-main: #f9fafb;
  --text-muted: #cbd5e1;
  --text-dimmed: #94a3b8;

  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #1e293b;
  --accent-border: #1e3a8a;

  --success-color: #22c55e;
  --success-bg: #064e3b;
  --success-border: #047857;

  --warning-color: #fbbf24;
  --warning-bg: #451a03;
  --warning-border: #78350f;

  --danger-color: #f87171;
  --danger-bg: #450a0a;
  --danger-border: #7f1d1d;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Reseteo y estructura base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

.mono-font {
  font-family: var(--font-mono);
}

.small-muted {
  color: var(--text-dimmed);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Layout principal */
.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Tarjeta principal de la herramienta */
.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.25rem;
    gap: 1.25rem;
  }
}

/* Cabecera interna de la herramienta */
.tool-hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid var(--accent-border);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  width: fit-content;
}

.tool-hero-title {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

@media (max-width: 640px) {
  .tool-hero-title {
    font-size: 1.5rem;
  }
}

.tool-hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 820px;
}

/* Zona Drag and Drop */
.dropzone {
  border: 2px dashed var(--border-color);
  background-color: var(--bg-card-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.dropzone-text h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Botones universales (mínimo 40px de altura táctil) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-subtle);
  border-color: var(--text-dimmed);
}

.btn-outline {
  background-color: transparent;
  color: var(--accent-color);
  border-color: var(--accent-border);
}

.btn-outline:hover {
  background-color: var(--accent-light);
}

.btn-full {
  width: 100%;
}

@media (max-width: 640px) {
  .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* Tarjeta de archivo seleccionado */
.file-info-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.file-info-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background-color: #ef4444;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

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

.file-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success-color);
  border: 1px solid var(--success-border);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-color);
  border: 1px solid var(--warning-border);
}

/* Opciones de conversión */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Selectores canónicos (regla canónica: ellipsis, explicit background/color, flecha SVG) */
.custom-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding: 0.6rem 2.5rem 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9375rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

[data-theme="dark"] .custom-select,
body.dark-theme .custom-select {
  background-color: var(--bg-card);
  color: var(--text-main);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.custom-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.custom-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Checkboxes accesibles */
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  min-height: 42px;
}

.checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.checkbox-card span {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Barra de progreso de conversión */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-color);
  border-radius: 9999px;
  transition: width 0.25s ease;
}

/* Área de resultados y estadísticas */
.results-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.stat-item {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-dimmed);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 640px) {
  .actions-row {
    flex-direction: column;
  }
}

/* Visor de previsualización de páginas */
.preview-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.preview-title {
  font-size: 1.15rem;
}

.preview-content-box {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-page);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preview-page-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-page-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-color);
  letter-spacing: 0.05em;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.5rem;
}

.preview-page-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-h1 {
  font-size: 1.35rem;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.preview-h2 {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-top: 0.4rem;
}

.preview-h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.preview-p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.preview-list-item {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
}

.preview-images-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.preview-thumb-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  object-fit: contain;
}

/* Modales canónicos (sin alert) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.25rem;
}

.modal-btn-close {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.modal-btn-close:hover {
  color: var(--text-main);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .modal-footer .btn {
    width: 100%;
  }
}

/* Toast flotante */
.app-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--text-main);
  color: var(--bg-card);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: none;
  z-index: 10000;
  animation: toastSlideUp 0.2s ease-out;
}

.app-toast.show {
  display: block;
}

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

/* -------------------------------------------------------------
   SECCIÓN DIDÁCTICA SEO Y GUÍA (CANÓNICO LECCIÓN 223)
   ------------------------------------------------------------- */
.seo-guide-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.5rem;
}

.seo-guide-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.seo-authority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-color);
  background-color: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  width: fit-content;
}

.seo-guide-title {
  font-size: 1.65rem;
}

.seo-guide-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.seo-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.seo-guide-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--accent-light);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.seo-guide-card h3 {
  font-size: 1.15rem;
}

.seo-guide-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

/* Tabla didáctica comparativa */
.guide-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.guide-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.guide-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
}

.guide-table tr:last-child td {
  border-bottom: none;
}

/* Acordeón de preguntas frecuentes (FAQ) */
.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.seo-faq-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.seo-faq-item[open] {
  border-color: var(--accent-border);
}

.seo-faq-question {
  padding: 1.1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

.seo-faq-question::-webkit-details-marker {
  display: none;
}

.seo-faq-question::after {
  content: '+';
  font-size: 1.35rem;
  color: var(--accent-color);
  font-weight: 400;
  transition: transform 0.2s ease;
}

.seo-faq-item[open] .seo-faq-question::after {
  content: '−';
}

.seo-faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}
