/* ==========================================================================
   OmniCrop Studio - Modern Glassmorphism & High-Precision Dark Theme
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette */
  --bg-darkest: #07090e;
  --bg-darker: #0d111a;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.85);
  --bg-glass-input: rgba(13, 17, 26, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);

  /* Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --cyan-accent: #06b6d4;
  --emerald-accent: #10b981;
  --rose-accent: #f43f5e;
  --amber-accent: #f59e0b;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Elevation */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-darkest);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.10) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
}

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

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

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(90deg, #818cf8, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: rgba(13, 17, 26, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 5px;
  border-radius: var(--radius-lg);
  gap: 4px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab svg {
  width: 18px;
  height: 18px;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.tab-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

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

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  color: #34d399;
  font-size: 0.78rem;
  font-weight: 600;
  transition: var(--transition);
}

.privacy-pill svg {
  width: 14px;
  height: 14px;
}

/* Selector de Idioma Multilenguaje */
.lang-selector {
  position: relative;
  display: inline-block;
  user-select: none;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.lang-btn:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.lang-icon {
  width: 15px;
  height: 15px;
  color: #818cf8;
  flex-shrink: 0;
}

.lang-current-code {
  letter-spacing: 0.05em;
  font-weight: 700;
}

.lang-arrow {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.lang-selector.open .lang-arrow {
  transform: rotate(180deg);
  color: #818cf8;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 155px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.18);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(2px);
}

.lang-option.active {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-weight: 700;
}

.lang-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-name {
  flex: 1;
}

.lang-check {
  font-size: 0.85rem;
  color: #818cf8;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lang-option.active .lang-check {
  opacity: 1;
}

/* ==========================================
   Main Application Area
   ========================================== */

.app-main {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* ==========================================
   Dropzones
   ========================================== */

.dropzone-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 520px;
  padding: 40px 20px;
}

.dropzone-box {
  width: 100%;
  max-width: 680px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 2px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 50px 30px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.dropzone-box:hover,
.dropzone-box.drag-over {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.file-input-hidden {
  display: none;
}

.dropzone-icon-pulse {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  animation: pulseGlow 3s infinite;
}

.dropzone-icon-pulse svg {
  width: 36px;
  height: 36px;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); }
}

.dropzone-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dropzone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  display: inline-block;
  max-width: 90%;
}

/* ==========================================
   Buttons & UI Elements
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

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

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
}

.btn-block {
  width: 100%;
}

.glow-btn {
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

.glow-btn:hover {
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.6);
}

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

.text-danger:hover {
  background: rgba(244, 63, 94, 0.1) !important;
}

.hidden {
  display: none !important;
}

/* ==========================================
   Workspace Toolbar
   ========================================== */

.workspace-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 20px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.pill-primary {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.pill-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.ref-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ref-indicator strong {
  color: #38bdf8;
}

.sub-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ==========================================
   Thumbnails Strip (Crop Selection)
   ========================================== */

.thumbnails-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 12px 2px;
  scroll-behavior: smooth;
}

.thumbnails-strip::-webkit-scrollbar {
  height: 6px;
}

.thumbnails-strip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-full);
}

.thumbnails-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.thumb-item {
  position: relative;
  flex: 0 0 110px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  background: #000;
  cursor: pointer;
  transition: var(--transition);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  transition: var(--transition);
}

.thumb-item:hover img {
  opacity: 1;
}

.thumb-item.active-ref {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.thumb-item.active-ref img {
  opacity: 1;
}

.thumb-ref-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #0284c7;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.thumb-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  opacity: 0;
  transition: var(--transition);
}

.thumb-item:hover .thumb-del-btn {
  opacity: 1;
}

.thumb-del-btn:hover {
  background: #ef4444;
}

/* ==========================================
   Crop Workspace: Editor Grid
   ========================================== */

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* Canvas Card */
.canvas-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.dim-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.canvas-quick-tools {
  display: flex;
  gap: 6px;
}

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

.icon-tool-btn svg {
  width: 16px;
  height: 16px;
}

.icon-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* Canvas Viewport */
.canvas-container {
  width: 100%;
  min-height: 480px;
  max-height: 600px;
  background: #090c13;
  background-image: 
    linear-gradient(45deg, #111622 25%, transparent 25%), 
    linear-gradient(-45deg, #111622 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #111622 75%), 
    linear-gradient(-45deg, transparent 75%, #111622 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  user-select: none;
}

.crop-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
  max-height: 100%;
}

.crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 580px;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

/* Interactive Crop Box Overlay */
.crop-overlay-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100px;
  height: 100px;
  box-sizing: border-box;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), 0 0 15px rgba(56, 189, 248, 0.4);
  cursor: move;
  touch-action: none;
}

/* Rule of Thirds Grid */
.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.grid-line-h.h-1 { top: 33.333%; }
.grid-line-h.h-2 { top: 66.666%; }

.grid-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.grid-line-v.v-1 { left: 33.333%; }
.grid-line-v.v-2 { left: 66.666%; }

/* Handles */
.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #38bdf8;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-e  { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-w  { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }

.crop-box-metrics {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  pointer-events: none;
  white-space: nowrap;
}

.canvas-footer-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0 4px;
}

/* ==========================================
   Controls Card & Settings
   ========================================== */

.controls-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.controls-heading {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
}

.controls-heading svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-tag {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.65rem;
  align-items: center;
  justify-content: center;
  cursor: help;
}

/* Ratio Chips */
.ratio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #a5b4fc;
}

/* Sync Options Radios */
.sync-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.radio-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary);
}

.radio-card.active {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.08);
}

.radio-card-content {
  flex: 1;
}

.radio-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-rec {
  font-size: 0.65rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 1px 6px;
  border-radius: 4px;
}

.radio-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.3;
}

/* Inputs grid */
.inputs-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.input-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-prefix {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 6px 6px 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.input-field input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 6px 8px;
  outline: none;
}

.styled-select, .styled-input {
  width: 100%;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition);
}

.styled-select:focus, .styled-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.styled-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.controls-actions-box {
  margin-top: 8px;
}

/* ==========================================
   Synchronized Previews Gallery
   ========================================== */

.preview-section {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

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

.preview-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.synced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.synced-card {
  background: rgba(13, 17, 26, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.synced-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.synced-card-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.synced-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.synced-card-preview-box {
  height: 200px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.synced-card-preview-box canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

.synced-card-footer {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-subtle);
}

.synced-card-stats {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================
   Stitch Section Layout
   ========================================== */

.stitch-grid {
  display: grid;
  grid-template-columns: 340px 380px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1200px) {
  .stitch-grid {
    grid-template-columns: 1fr;
  }
}

.stitch-list-card, .stitch-config-card, .stitch-preview-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stitch-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.stitch-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(13, 17, 26, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.stitch-item-row:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.stitch-item-thumb {
  width: 50px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
}

.stitch-item-meta {
  flex: 1;
  overflow: hidden;
}

.stitch-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stitch-item-dims {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.stitch-item-actions {
  display: flex;
  gap: 4px;
}

.stitch-btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.stitch-btn-icon svg {
  width: 14px;
  height: 14px;
}

.stitch-btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.stitch-btn-icon.del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Color Presets */
.bg-color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-preset-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.color-preset-pill.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.checkerboard-dot {
  background: repeating-conic-gradient(#808080 0% 25%, #ffffff 0% 50%) 50% / 8px 8px;
}

.white-dot { background: #ffffff; }
.black-dot { background: #000000; }

.custom-color-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.custom-color-wrap input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

/* Stitched Canvas Preview */
.stitch-preview-scroll {
  background: #06080d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-height: 520px;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.stitch-canvas-wrap {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: flex;
}

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

/* ==========================================
   PDF Section Layout
   ========================================== */

.pdf-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1000px) {
  .pdf-grid {
    grid-template-columns: 1fr;
  }
}

.pdf-config-card, .pdf-pages-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.radio-horizontal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
}

.radio-label input {
  accent-color: var(--primary);
}

.radio-label:has(input:checked) {
  color: var(--text-main);
  font-weight: 600;
}

.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  max-height: 580px;
  overflow-y: auto;
  padding: 4px;
}

.pdf-page-card {
  background: rgba(13, 17, 26, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}

.pdf-page-num-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  z-index: 2;
}

.pdf-page-thumb {
  height: 150px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.pdf-page-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.pdf-page-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pdf-page-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-page-dims {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.pdf-page-actions {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================
   Modal & Toasts
   ========================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.spinner-loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.progress-bar-wrapper {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  transition: width 0.15s ease-out;
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #a5b4fc;
  font-weight: 600;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  animation: slideInRight 0.25s ease-out forwards;
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #f43f5e;
}

.toast-info {
  border-left: 4px solid #38bdf8;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================
   Overlay Global de Arrastrar y Soltar
   ========================================== */
.global-drag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 14, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: fadeIn 0.15s ease-out;
}

.global-drag-content {
  background: rgba(18, 24, 38, 0.98);
  border: 3px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 50px 70px;
  text-align: center;
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
  animation: pulseDropzone 2s infinite alternate;
}

@keyframes pulseDropzone {
  from { transform: scale(1); border-color: #6366f1; }
  to { transform: scale(1.02); border-color: #38bdf8; }
}

.global-drag-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.global-drag-icon svg {
  width: 40px;
  height: 40px;
}

.global-drag-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.global-drag-desc {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Tarjeta para añadir más en tira de miniaturas */
.thumb-add-card {
  border: 2px dashed rgba(99, 102, 241, 0.45) !important;
  background: rgba(99, 102, 241, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

.thumb-add-card:hover {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.18) !important;
  transform: translateY(-2px);
}

.thumb-add-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 700;
  pointer-events: none;
}

.thumb-add-inner svg {
  width: 22px;
  height: 22px;
}

