/* ============================================================
   ANONIMIZADOR Y TACHADOR DE PDF Y DOCUMENTOS - FIJATE TOOLS
   Diseño moderno, fluido, accesible y 100 % local
   ============================================================ */

:root {
  color-scheme: dark;
  --bg-body: #0c0f17;
  --bg-surface: #141824;
  --bg-card: rgba(26, 32, 48, 0.7);
  --bg-card-hover: rgba(32, 40, 60, 0.85);
  --bg-input: #101420;
  --bg-editor: #090c13;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #ff8507;
  --primary: #ff8507;
  --primary-hover: #ff9924;
  --primary-glow: rgba(255, 133, 7, 0.25);
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.25);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-editor: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #ff8507;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   CABECERA
   ============================================================ */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-back-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.btn-back-tools:hover {
  background: rgba(255, 133, 7, 0.1);
  color: var(--primary);
  border-color: rgba(255, 133, 7, 0.3);
}

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

.brand-logo-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 133, 7, 0.2), rgba(244, 63, 94, 0.2));
  border: 1px solid rgba(255, 133, 7, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

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

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.badge-local {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   CONTENIDO Y SIDEBAR
   ============================================================ */
.main-wrapper {
  flex: 1;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr;
  }
}

.tool-main-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero */
.tool-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-hero h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.tool-hero p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 800px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

/* ============================================================
   DROPZONE / SUBIDA DE ARCHIVOS
   ============================================================ */
.upload-container {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

.upload-container:hover,
.upload-container.drag-over {
  border-color: var(--primary);
  background: rgba(255, 133, 7, 0.04);
}

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

.upload-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 133, 7, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-text h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.upload-link {
  color: var(--primary);
  text-decoration: underline;
}

.upload-text p {
  color: var(--text-secondary);
  font-size: 13px;
}

.upload-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.file-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ============================================================
   EDITOR WORKSPACE
   ============================================================ */
.editor-workspace {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-subtle);
}

/* Barra de herramientas */
.editor-toolbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-group-segmented {
  display: inline-flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 3px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tool-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tool-btn.active {
  background: var(--primary);
  color: #0b0f17 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.tool-color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.swatch-black {
  background: #000000;
  border: 1px solid #ffffff44;
}

.swatch-white {
  background: #ffffff;
  border: 1px solid #00000033;
}

.swatch-yellow {
  background: #ffd600;
}

/* Navegación de páginas */
.page-nav-group {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  display: flex;
  align-items: center;
}

.btn-page-nav {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-page-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

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

.page-counter {
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
  color: var(--text-primary);
}

/* Botones de acción del toolbar */
.actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ============================================================
   CANVAS VIEWPORT & STAGE
   ============================================================ */
.canvas-viewport {
  background: #05070a;
  min-height: 480px;
  max-height: 720px;
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

[data-theme="light"] .canvas-viewport {
  background: #e2e8f0;
}

.canvas-stage {
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  background: #ffffff;
  overflow: hidden;
  user-select: none;
  cursor: crosshair;
}

.pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.drawing-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: crosshair;
}

/* Barra inferior del editor */
.editor-bottom-bar {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bottom-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-separator {
  color: var(--border-color);
}

.bottom-export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.quality-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dpi-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.select-clean {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.select-clean:focus {
  border-color: var(--primary);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #0b0f17 !important;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary-action:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* ============================================================
   SECCIÓN EDUCATIVA Y FAQ
   ============================================================ */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
}

.info-section h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-card-icon.danger {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
}

.info-card-icon.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
}

.info-card-icon.primary {
  background: rgba(255, 133, 7, 0.12);
  color: var(--primary);
}

.info-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.info-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* FAQ */
.faq-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  position: relative;
}

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

.faq-question::after {
  content: '+';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-secondary);
}

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

.faq-answer {
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================================
   MODALES PERSONALIZADOS
   ============================================================ */
.custom-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.custom-modal-backdrop.show {
  display: flex;
}

.custom-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.custom-modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-modal-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
}

.custom-modal-body {
  padding: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.custom-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-modal-secondary {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.btn-modal-danger {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-rose);
  border: 1px solid var(--accent-rose);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-emerald);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header-container {
    padding: 10px 14px;
  }
  
  .brand-title {
    font-size: 14px;
  }
  
  .brand-subtitle {
    display: none;
  }

  .editor-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-group-segmented {
    width: 100%;
    overflow-x: auto;
  }

  .editor-bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .bottom-export-actions {
    flex-direction: column;
  }

  .btn-primary-action,
  .btn-secondary-action,
  .select-clean {
    width: 100%;
    justify-content: center;
  }
}
