:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #8b5cf6;
  --primary-soft: #ede9fe;
  --accent: #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.22);
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px -12px rgba(124, 58, 237, 0.18);
  --gradient: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 55%, #a855f7 100%);
  --pix-green: #00bdae;
  --pix-dark: #065f46;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.10), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(168, 85, 247, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(139, 92, 246, 0.06), transparent);
  pointer-events: none;
  z-index: -1;
}

.hidden { display: none !important; }

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container--footer { padding-bottom: 3rem; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.2rem;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -4px rgba(124, 58, 237, 0.45);
  flex-shrink: 0;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-nav a,
.site-nav button {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
}

.site-nav a:hover,
.site-nav button:hover {
  color: var(--text);
  background: rgba(124, 58, 237, 0.08);
}

/* Hero */
.hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.55rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.hero-title-highlight {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  max-width: 720px;
  margin: 0 auto 1.25rem;
  color: var(--text-muted);
  font-size: 1.04rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.78rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.badge svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.stats-counter-card {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 1.2rem;
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: 14px;
  box-shadow: 0 6px 20px -6px rgba(124, 58, 237, 0.16);
  margin: 0 auto 0.5rem;
}

.stats-counter-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-counter-icon svg { width: 20px; height: 20px; }

.stats-live-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}

.stats-counter-body {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.stats-counter-main {
  font-size: 0.92rem;
  color: var(--text);
}

.stats-counter-number {
  color: var(--primary-dark);
  font-weight: 800;
}

.stats-counter-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* App Card */
.app-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

/* Mode Tabs (QR Code vs Código de Barras) */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: #f1f5f9;
  padding: 0.45rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab svg { width: 20px; height: 20px; }

.mode-tab.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* 2-Column Workspace */
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.studio-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-block {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
}

.control-block-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.control-step-badge {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--gradient);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* QR Template Chips */
.template-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.template-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 0.65rem;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
}

.template-chip:hover {
  border-color: var(--primary-light);
  background: #faf5ff;
}

.template-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* Form Fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.field-group.full {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-textarea {
  min-height: 88px;
  resize: vertical;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

/* Color & Style Controls */
.color-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.color-picker {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.color-presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-swatch:hover { transform: scale(1.12); }

.pill-options {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 0.45rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* Logo Upload Box */
.logo-upload-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem;
  background: #ffffff;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
}

.logo-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.btn-small {
  padding: 0.42rem 0.78rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-small:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-small.danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

/* Sticky Preview Column */
.studio-preview {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.preview-stage {
  width: 100%;
  min-height: 280px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.preview-stage canvas,
.preview-stage svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.validation-box {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

.validation-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.validation-box.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.validation-box.info {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #5b21b6;
}

.pix-copy-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pix-copy-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pix-copy-input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
}

/* Export Actions */
.export-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.btn-primary-download {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border: none;
  border-radius: 12px;
  background: var(--gradient);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px -6px rgba(124, 58, 237, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -6px rgba(124, 58, 237, 0.55);
}

.btn-secondary-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-download:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #faf5ff;
}

.a4-sheet-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.a4-sheet-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
}

.a4-sheet-row {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Toast & Offline */
.toast-notice {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
  z-index: 9999;
  transition: transform 0.25s ease;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
}

#offline-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.offline-box {
  background: #ffffff;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  max-width: 360px;
}

/* Editorial Guide & FAQ */
.guide-article {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}

.guide-article h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.guide-article h3 {
  font-size: 1.18rem;
  font-weight: 800;
  margin: 1.35rem 0 0.6rem;
}

.guide-article p,
.guide-article li {
  color: #334155;
  margin-bottom: 0.6rem;
}

.guide-article ol,
.guide-article ul {
  padding-left: 1.35rem;
  margin-bottom: 1rem;
}

.table-responsive {
  overflow-x: auto;
  margin: 1rem 0;
}

.editorial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.editorial-table th,
.editorial-table td {
  border: 1px solid var(--border);
  padding: 0.7rem 0.85rem;
  text-align: left;
}

.editorial-table th {
  background: #f5f3ff;
  color: var(--primary-dark);
  font-weight: 800;
}

.faq-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.faq-section details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  background: #f8fafc;
}

.faq-section summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}

.faq-section details p {
  margin-top: 0.65rem;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin-top: 1rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.footer-col h4 {
  font-size: 0.98rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.footer-col p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.footer-col a:hover { color: var(--primary-dark); }

.footer-bottom {
  text-align: center;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .studio-preview {
    position: static;
  }
}

@media (max-width: 600px) {
  .app-card { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .export-actions { grid-template-columns: 1fr; }
  .mode-tabs { grid-template-columns: 1fr; }
}
