/**
 * Estilos canónicos de la herramienta Quitar Ojos Rojos
 * Fijate Tools (fijate.com)
 */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Corporativa en Tema Claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-green-hover: #059669;

  --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 -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --canvas-bg: #1e293b;
  --canvas-grid: #334155;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b28;
  --bg-subtle: #1a2436;
  --bg-input: #0f1622;
  --border-color: #243247;
  --border-focus: #60a5fa;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #8493a8;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #172554;

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

  --canvas-bg: #090d14;
  --canvas-grid: #172030;
}

/* Reset y estructura */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .brand-title, .section-title, .seo-guide-section h2, .seo-guide-section h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

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

/* Layout */
.main-wrapper {
  flex: 1 0 auto;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.25rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

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

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta Principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1rem;
    border-radius: var(--radius-md);
  }
}

/* Badge de Privacidad 100 % Local */
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(16, 185, 129, 0.09);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--text-secondary);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

.privacy-badge svg {
  color: var(--accent-green);
  flex-shrink: 0;
}

/* ==========================================
   ESTADO 1: ZONA DE SUBIDA (DROPZONE)
   ========================================== */
.upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.75rem 1.5rem;
  text-align: center;
  background: var(--bg-subtle);
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.dropzone-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 1.75rem;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Instrucciones rápidas */
.quick-instructions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .quick-instructions {
    grid-template-columns: 1fr;
  }
}

.instruction-step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.step-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ==========================================
   ESTADO 2: EDITOR Y LIENZO
   ========================================== */
.editor-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Barra superior de herramientas */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
}

.tool-group, .history-group, .zoom-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  min-height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--primary);
}

.tool-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.tool-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

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

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 0.25rem;
}

/* Panel de ajustes de corrección */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-label {
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.select-control {
  min-height: 40px;
  padding: 0.4rem 2.2rem 0.4rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.86rem;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

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

.slider-control {
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
  width: 110px;
}

@media (max-width: 640px) {
  .slider-control {
    width: 90px;
  }
}

.control-val {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 48px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* Viewport del lienzo */
.viewport-container {
  position: relative;
  width: 100%;
  height: 580px;
  background: var(--canvas-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

@media (max-width: 768px) {
  .viewport-container {
    height: 420px;
  }
}

.canvas-transform-box {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#main-canvas {
  display: block;
  background-image:
    linear-gradient(45deg, var(--canvas-grid) 25%, transparent 25%),
    linear-gradient(-45deg, var(--canvas-grid) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--canvas-grid) 75%),
    linear-gradient(-45deg, transparent 75%, var(--canvas-grid) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Cursor circular interactivo */
.brush-cursor {
  position: absolute;
  pointer-events: none;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
}

.brush-cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #ffffff;
  box-shadow: 0 0 2px #000000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Barra inferior de acciones */
.editor-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
}

.actions-left, .actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

@media (max-width: 640px) {
  .editor-actions-bar,
  .actions-left,
  .actions-right {
    width: 100%;
  }
  .actions-left .btn,
  .actions-right .btn,
  .actions-right .select-control {
    width: 100%;
  }
}

/* Botones estándar */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  min-height: 42px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--accent-green-hover);
}

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

.btn-outline:hover, .btn-outline.active {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Modal corporativo */
.app-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.app-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalEnter 0.2s ease-out;
}

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

.modal-header {
  padding: 1.15rem 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.modal-footer {
  padding: 0.85rem 1.25rem 1.15rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
}

/* Sección SEO y Guía Didáctica */
.seo-guide-section {
  margin-top: 2.5rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .seo-guide-section {
    padding: 1.25rem;
  }
}

.seo-guide-section h2 {
  font-size: 1.45rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.seo-guide-section h3 {
  font-size: 1.15rem;
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.seo-guide-section p {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.94rem;
  margin-bottom: 1rem;
}

.seo-guide-section ul, .seo-guide-section ol {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.94rem;
  padding-left: 1.4rem;
  margin-bottom: 1.25rem;
}

.seo-guide-section li {
  margin-bottom: 0.45rem;
}

/* Acordeón FAQ */
.faq-accordion {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-summary {
  padding: 1rem 0;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

details[open] .faq-summary::after {
  content: '−';
}

.faq-content {
  padding-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}
