/* ══════════════════════════════════════════════
   INTERACTIVE DEMO SECTION
══════════════════════════════════════════════ */

.demo-section { background: var(--bg); }

.demo-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: start;
}

/* ── Tab sidebar ─────────────────────────────────────────── */

.demo-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 80px;
}

.demo-tab {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.demo-tab:hover {
  background: var(--surface);
  border-color: var(--border);
}
.demo-tab.active {
  background: var(--surface);
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
}

.demo-tab-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  color: var(--text-2);
}
.demo-tab.active .demo-tab-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.demo-tab-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 1px;
}
.demo-tab-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── Demo panel ──────────────────────────────────────────── */

.demo-panel { display: none; }
.demo-panel.active { display: block; animation: fade-in 0.3s ease; }

.demo-window {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl), var(--glow);
  border: 1px solid var(--border);
}

.demo-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Dashboard demo ──────────────────────────────────────── */

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dash-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
}
.dash-alerts-list::-webkit-scrollbar { width: 4px; }
.dash-alerts-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Traza demo ──────────────────────────────────────────── */

.traza-demo-search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.traza-demo-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.traza-chip {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
}
.traza-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

.traza-demo-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}

.traza-result {
  display: none;
  flex-direction: column;
  gap: 7px;
}
.traza-result.visible { display: flex; }

.traza-result-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slide-in-up 0.35s ease backwards;
}
.traza-result-card:nth-child(1) { animation-delay: 0.00s; }
.traza-result-card:nth-child(2) { animation-delay: 0.08s; }
.traza-result-card:nth-child(3) { animation-delay: 0.16s; }
.traza-result-card:nth-child(4) { animation-delay: 0.24s; }

.traza-result-icon {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.traza-result-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 1px;
}
.traza-result-val { font-weight: 600; color: var(--text-1); font-size: 0.78rem; }
.traza-result-sub { font-size: 0.68rem; color: var(--text-2); font-family: var(--font-mono); }

/* ── Inventario demo ─────────────────────────────────────── */

.inv-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
}

.inv-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inv-field-wrap { display: flex; flex-direction: column; gap: 3px; }
.inv-field-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inv-field {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.8rem;
  color: var(--text-1);
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.inv-field:focus { border-color: var(--accent); }

#inv-result {
  display: none;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ── Dosificación demo ───────────────────────────────────── */

.dosi-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.dosi-progress-wrap {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.dosi-progress-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.dosi-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.5s ease, background 0.3s;
}
.dosi-progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
}

.dosi-ingredients {
  padding: 0 16px;
  overflow-y: auto;
  max-height: 220px;
}

#dosi-done {
  display: none;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

/* ── Salida bodega demo ──────────────────────────────────── */

.salida-scanner-wrap {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.salida-scanner-box {
  position: relative;
  height: 90px;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
}
.salida-scanner-icon {
  font-size: 1.8rem;
  opacity: 0.3;
  position: relative;
  z-index: 1;
}
.salida-scanner-label {
  font-size: 0.72rem;
  color: var(--text-3);
  position: absolute;
  bottom: 8px;
  left: 0; right: 0;
  text-align: center;
}

#salida-scanner-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  top: 0;
  opacity: 0;
}
@keyframes scan-line {
  0%   { top: 0;   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.salida-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.salida-chip {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
}
.salida-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

.salida-search-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

#salida-result { display: none; padding: 12px 16px; border-top: 1px solid var(--border); }
#salida-error  { display: none; font-size:0.78rem; color:var(--danger);
  background:var(--danger-light); padding:8px 12px; border-radius:6px;
  margin: 0 16px 10px; }

/* ── Shared app layout ───────────────────────────────────── */

.app-chrome {
  display: flex;
  height: 460px;
  overflow: hidden;
}

.app-sidebar {
  width: 130px;
  background: #1e3a5f;
  flex-shrink: 0;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-sidebar-logo {
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  padding: 0 10px 10px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 6px;
}
.app-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.app-nav-item:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.05); }
.app-nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-left-color: #3b82f6;
  font-weight: 600;
}
.app-nav-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.6; flex-shrink: 0; }

.app-main {
  flex: 1;
  background: #f1f5f9;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
[data-theme="dark"] .app-main { background: #0b1525; }

.app-page-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-1);
}

@media (max-width: 900px) {
  .demo-layout { grid-template-columns: 1fr; }
  .demo-tabs { flex-direction: row; position: static; overflow-x: auto; padding-bottom: 4px; }
  .demo-tab { min-width: 180px; }
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
