/* ============================================================
   RetailGen — Design System (Dark Mode + Glassmorphism)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg-base:        #0a0a0f;
  --bg-surface:     #111118;
  --bg-elevated:    #1a1a28;
  --glass-bg:       rgba(255,255,255,0.04);
  --glass-border:   rgba(255,255,255,0.08);
  --glass-hover:    rgba(255,255,255,0.07);

  --indigo:         #6366f1;
  --violet:         #8b5cf6;
  --indigo-light:   #a5b4fc;
  --violet-light:   #c4b5fd;
  --accent-glow:    rgba(99,102,241,0.3);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-code:      #a78bfa;

  --success:        #10b981;
  --error:          #f43f5e;
  --warning:        #f59e0b;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-glow:0 0 40px rgba(99,102,241,0.15);

  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset ──────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Glass Card ─────────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 28px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.glass-card:hover { border-color: rgba(255,255,255,0.13); box-shadow: var(--shadow-glow); }

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 16px;
}
.header__brand { display: flex; align-items: center; gap: 12px; }
.header__logo { display:flex; align-items:center; flex-shrink:0; }
.header__title {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--indigo-light), var(--violet-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header__subtitle { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.header__nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--glass-hover); }
.nav-link--api {
  background: rgba(99,102,241,0.12); color: var(--indigo-light);
  border: 1px solid rgba(99,102,241,0.25);
}
.nav-link--api:hover { background: rgba(99,102,241,0.2); color: var(--violet-light); }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative; padding: 80px 0 60px;
  overflow: hidden;
}
.hero__bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%, rgba(99,102,241,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 80% 60%, rgba(139,92,246,0.10) 0%, transparent 70%);
}
.hero__content { position: relative; text-align: center; }
.hero__badge {
  display: inline-block; margin-bottom: 20px;
  padding: 6px 18px; border-radius: 999px;
  background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25);
  font-size: 0.78rem; font-weight: 600; color: var(--indigo-light); letter-spacing: 0.04em;
}
.hero__heading {
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15;
  letter-spacing: -0.03em; color: var(--text-primary); margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 60%, #ec4899 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero__description {
  max-width: 640px; margin: 0 auto 32px;
  color: var(--text-secondary); font-size: 1.05rem; line-height: 1.7;
}
.hero__stats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.stat-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition);
}
.stat-chip:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
.stat-chip__icon { font-size: 1rem; }

/* ── Main ───────────────────────────────────────────────── */
.main { padding: 40px 0 60px; display: flex; flex-direction: column; gap: 32px; }

/* ── Section Title ──────────────────────────────────────── */
.section-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.section-title__icon { font-size: 1.2rem; }

/* ── Controls Panel ─────────────────────────────────────── */
.controls-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .controls-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .controls-grid { grid-template-columns: 1fr; } }

.control-group { display: flex; flex-direction: column; gap: 10px; }
.control-label {
  font-size: 0.875rem; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px;
}
.control-label__value {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--indigo-light); background: rgba(99,102,241,0.1);
  padding: 2px 8px; border-radius: 4px;
}
.control-label__hint { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; width: 100%; }

/* Slider */
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--indigo) 0%, var(--indigo) var(--slider-pct,3%), var(--bg-elevated) var(--slider-pct,3%), var(--bg-elevated) 100%);
  transition: background var(--transition);
}
.slider--accent { --thumb-color: var(--violet); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  box-shadow: 0 0 10px var(--accent-glow); cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.25); box-shadow: 0 0 18px var(--accent-glow); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  box-shadow: 0 0 10px var(--accent-glow); cursor: pointer;
}
.slider-range-labels {
  display: flex; justify-content: space-between;
  font-size: 0.7rem; color: var(--text-muted); font-weight: 500;
}

/* Text Input */
.text-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--glass-border);
  color: var(--text-primary); font-family: var(--font-mono); font-size: 0.9rem;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.text-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.text-input::placeholder { color: var(--text-muted); }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Entities Section ───────────────────────────────────── */
.entities-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.entities-header .section-title { margin-bottom: 0; }
.entities-actions { display: flex; gap: 8px; }
.entities-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }

/* ── Entity Card ────────────────────────────────────────── */
.entity-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 22px;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.entity-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  transform: scaleX(0); transform-origin: left; transition: transform var(--transition);
}
.entity-card:hover::before { transform: scaleX(1); }
.entity-card:hover { border-color: rgba(99,102,241,0.3); box-shadow: var(--shadow-glow); }
.entity-card--target { border-color: rgba(139,92,246,0.35); }
.entity-card--target::before { transform: scaleX(1); }

.entity-card__header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.entity-card__icon { font-size: 1.6rem; flex-shrink: 0; }
.entity-card__meta { flex: 1; }
.entity-card__title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.entity-card__desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.entity-card__toggle {
  flex-shrink: 0; width: 40px; height: 22px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--glass-border);
  cursor: pointer; position: relative; transition: all var(--transition);
  appearance: none; -webkit-appearance: none;
}
.entity-card__toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted);
  transition: all var(--transition);
}
.entity-card__toggle:checked { background: linear-gradient(135deg, var(--indigo), var(--violet)); border-color: var(--indigo); }
.entity-card__toggle:checked::after { left: calc(100% - 17px); background: white; }

.variable-list { display: flex; flex-direction: column; gap: 6px; }
.variable-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition);
}
.variable-item:hover { background: rgba(255,255,255,0.04); }
.variable-item__cb {
  width: 16px; height: 16px; border-radius: 4px; cursor: pointer; flex-shrink: 0;
  accent-color: var(--indigo);
}
.variable-item__label { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); flex: 1; }
.variable-item__type {
  font-size: 0.68rem; font-family: var(--font-mono); padding: 2px 6px;
  border-radius: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
}
.type-numeric  { background: rgba(99,102,241,0.15); color: var(--indigo-light); }
.type-boolean  { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.type-categorical { background: rgba(245,158,11,0.15); color: #fcd34d; }
.type-date     { background: rgba(244,63,94,0.15); color: #fda4af; }
.variable-item__target {
  font-size: 0.68rem; font-weight: 700; color: var(--violet-light);
  background: rgba(139,92,246,0.15); padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Skeleton Loading ───────────────────────────────────── */
.catalog-loading { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.skeleton-card {
  height: 220px; border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.05) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Catalog Error ──────────────────────────────────────── */
.catalog-error {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 48px 24px; background: var(--glass-bg); border: 1px solid rgba(244,63,94,0.25);
  border-radius: var(--radius-lg); text-align: center;
}
.catalog-error__icon { font-size: 2.5rem; }
.catalog-error p { color: var(--text-secondary); font-size: 0.9rem; }

/* ── Preview Table ──────────────────────────────────────── */
.preview-section { overflow: hidden; }
.table-wrapper { overflow-x: auto; margin-top: 8px; border-radius: var(--radius-md); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  background: rgba(99,102,241,0.15); color: var(--indigo-light);
  padding: 10px 14px; text-align: left; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid rgba(99,102,241,0.2);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.03em;
}
.data-table td {
  padding: 8px 14px; color: var(--text-secondary); white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: var(--font-mono); font-size: 0.78rem;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.data-table td:last-child { color: var(--violet-light); font-weight: 600; }

/* ── Generate CTA ───────────────────────────────────────── */
.generate-card {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 20px;
}
.generate-card__label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.generate-card__meta { font-size: 0.95rem; color: var(--text-secondary); }
.generate-card__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px;
  border-radius: var(--radius-md); font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none; transition: all var(--transition);
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0; background: white;
  opacity: 0; border-radius: inherit; transition: opacity var(--transition);
}
.btn:active::after { opacity: 0.08; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn__icon { font-size: 1rem; }

.btn--primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  color: white; box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(99,102,241,0.5); }
.btn--primary:active:not(:disabled) { transform: translateY(0); }

.btn--outline {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn--outline:hover:not(:disabled) { color: var(--text-primary); border-color: rgba(255,255,255,0.2); background: var(--glass-hover); }

.btn--ghost { background: transparent; color: var(--text-muted); font-size: 0.82rem; padding: 7px 14px; }
.btn--ghost:hover { color: var(--text-secondary); background: var(--glass-hover); }
.btn--sm { padding: 7px 14px; font-size: 0.82rem; border-radius: var(--radius-sm); }

/* Loading spinner inside button */
.btn--loading .btn__icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── About Section ──────────────────────────────────────── */
.about-section { padding: 40px 0 60px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.about-card__title { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.about-card__text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.7; }
.about-list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 0.84rem; color: var(--text-secondary); }
.about-list strong { color: var(--text-primary); }
.code-block {
  display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-code);
  background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border);
  padding: 12px; border-radius: var(--radius-sm); margin-top: 8px; line-height: 1.8;
}
.code-inline {
  font-family: var(--font-mono); font-size: 0.85em; color: var(--text-code);
  background: rgba(167,139,250,0.1); padding: 1px 5px; border-radius: 3px;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--glass-border);
  padding: 28px 0;
  background: rgba(255,255,255,0.01);
}
.footer__inner { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.footer__copy { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.footer__note { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }

/* ── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  min-width: 280px; max-width: 420px; padding: 14px 18px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md); display: flex; align-items: flex-start; gap: 12px;
  pointer-events: auto; animation: slideIn 0.3s ease forwards;
  backdrop-filter: blur(12px);
}
.toast--success { border-color: rgba(16,185,129,0.4); }
.toast--error   { border-color: rgba(244,63,94,0.4); }
.toast--info    { border-color: rgba(99,102,241,0.4); }
.toast__icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast__text { flex: 1; }
.toast__title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.toast__body  { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes slideOut { to { opacity:0; transform: translateX(20px); } }
.toast--out { animation: slideOut 0.3s ease forwards; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--bg-surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl); padding: 32px; width: 100%; max-width: 500px;
  box-shadow: var(--shadow-md), 0 0 40px rgba(99,102,241,0.1);
  transform: translateY(20px) scale(0.95); transition: all var(--transition);
}
.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 1.5rem; font-weight: 700; background: linear-gradient(135deg, var(--indigo-light), var(--violet-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.project-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; max-height: 300px; overflow-y: auto; }
.project-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; background: var(--bg-elevated); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition);
}
.project-item:hover { border-color: var(--indigo); background: rgba(99,102,241,0.05); }
.project-item__name { font-weight: 600; font-size: 1rem; color: var(--text-primary); margin-bottom: 4px; }
.project-item__date { font-size: 0.75rem; color: var(--text-muted); }

.project-empty { text-align: center; padding: 32px 16px; color: var(--text-secondary); font-size: 0.9rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .header__inner { padding: 0 16px; }
  .header__subtitle { display: none; }
  .hero { padding: 48px 0 40px; }
  .generate-card { flex-direction: column; align-items: stretch; }
  .generate-card__actions { flex-direction: column; }
  .btn { justify-content: center; }
}
