/* ========== Herramientas de Imagen - Main Styles ========== */

:root {
  --bg-dark: #0f0f12;
  --bg-card: #18181c;
  --bg-card-hover: #1e1e24;
  --accent: #22d3ee;
  --accent-dim: #0891b2;
  --accent-glow: rgba(34, 211, 238, 0.15);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #27272a;
  --success: #34d399;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ========== Header con efectos ========== */
header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

header::after {
  content: '';
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: fadeInDown 0.6s ease-out;
}

.logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 0 40px var(--accent-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: scaleIn 0.6s ease-out 0.2s both;
}

.logo-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(34, 211, 238, 0.25);
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Animaciones del header */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Nav con animación escalonada */
.tool-nav {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.5s both;
}

.tool-nav-btn {
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.tool-nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.tool-nav-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== Efecto aparición secciones ========== */
.tool-section {
  display: none;
}

.tool-section.active {
  display: block;
  animation: sectionEnter 0.4s ease-out forwards;
}

@keyframes sectionEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Resto de estilos ========== */
.mode-switcher {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.mode-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.mode-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .converter-grid { grid-template-columns: 1fr; }
  .convert-center { flex-direction: row; padding: 0; }
}

.drop-zone {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  transition: all 0.25s ease;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--accent-dim);
}

.drop-zone input { display: none; }

.drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drop-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.drop-zone.dragover .drop-icon { background: var(--accent-glow); }

.drop-text { font-size: 1rem; color: var(--text-secondary); }
.drop-text strong { color: var(--text-primary); }
.drop-hint { font-size: 0.85rem; color: var(--text-muted); }

.btn-browse {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-browse:hover { background: var(--accent-glow); }

.preview-container {
  width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-dark);
}

.preview-container img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.file-info {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.convert-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding-top: 1rem;
}

.arrow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-muted);
}

.btn-convert {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.9rem 1.75rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: none;
  color: var(--bg-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-convert:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.btn-convert:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.quality-control {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  display: none;
}

.quality-control.visible { display: block; }

.quality-control label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.quality-control span {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
}

.quality-control input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
}

.quality-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.output-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-download {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  background: var(--success);
  border: none;
  color: var(--bg-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-download:hover { filter: brightness(1.1); }

.btn-reset {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.zone-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

footer p { font-size: 0.85rem; color: var(--text-muted); }

/* SEO content */
.seo-content {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.seo-content h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.seo-content h3 {
  font-size: 1rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
}

.seo-content p, .seo-content li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.seo-content ul {
  margin: 0;
  padding-left: 1.5rem;
}

/* Watermark tool */
.watermark-tool { max-width: 900px; margin: 0 auto; }

.watermark-canvas-wrap {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
}

.watermark-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  cursor: crosshair;
}

.watermark-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.watermark-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.watermark-controls input[type="range"] {
  width: 100px;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
}

.watermark-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.watermark-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Collage & PDF */
.multi-drop-zone { min-height: 200px; }

.thumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.thumb-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-dark);
  flex-shrink: 0;
}

.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-item .thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-item .thumb-num {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.thumb-item.dragover { outline: 2px solid var(--accent); }

.layout-options { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }

.layout-btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.layout-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
.layout-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.layout-grid { max-width: 100%; }

.collage-preview-wrap {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
  max-height: 400px;
  overflow: auto;
}

.collage-preview-wrap canvas { max-width: 100%; display: block; margin: 0 auto; }

/* Resize */
.resize-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.resize-controls label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.resize-controls input[type="number"] { width: 80px; padding: 0.4rem; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); }

/* Text tool */
.text-tool-wrap { position: relative; display: inline-block; max-width: 100%; margin: 1rem 0; }

.text-canvas-wrap {
  position: relative;
  display: inline-block;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.text-canvas-wrap canvas { display: block; max-width: 100%; cursor: default; }

.text-overlay {
  position: absolute;
  padding: 0.5rem 1rem;
  cursor: move;
  user-select: none;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  border: 2px dashed rgba(34, 211, 238, 0.5);
  border-radius: 4px;
  min-width: 40px;
  min-height: 24px;
}

.text-overlay:hover { border-color: var(--accent); background: rgba(34, 211, 238, 0.1); }
.text-overlay:empty::before { content: 'Tu texto'; color: var(--text-muted); }

.text-tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.text-tool-controls label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); }
.text-tool-controls input[type="text"] { flex: 1; min-width: 120px; padding: 0.5rem; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); }
.text-tool-controls input[type="color"] { width: 36px; height: 28px; padding: 2px; cursor: pointer; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 4px; }
.text-tool-controls select { padding: 0.4rem; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 0.85rem; }

/* Metadata & BG removal */
.checkered-bg {
  background-image: linear-gradient(45deg, #27272a 25%, transparent 25%),
    linear-gradient(-45deg, #27272a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #27272a 75%),
    linear-gradient(-45deg, transparent 75%, #27272a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #1e1e24;
}

.bg-sample-preview {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 2px solid var(--border);
  vertical-align: middle;
  margin-left: 0.5rem;
}
