/* ============================================================
   Demo 4 — MVP Completo: Plataforma SaaS / Clasificados con IA.
   Simulación 100% front-end (sin IA real, sin backend). Piezas
   específicas: mockup de teléfono, feed con skeleton loaders,
   sheet de publicación y toast de mensajería en tiempo real.
   Lo compartido con otras demos vive en demo-shared.css.
   ============================================================ */

/* LIVE DEMO SECTION */
.demo4-demo { padding-block: 24px 80px; }
.demo4-demo > .section-heading { margin-top: 8px; }
.demo4-demo > .section-sub { margin-bottom: 40px; }

.demo4-stage { display: flex; flex-direction: column; align-items: center; gap: 24px; }

/* Phone frame */
.demo4-phone {
  position: relative;
  width: 340px;
  height: 620px;
  background: var(--bg);
  border: 10px solid var(--card-2);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}
.demo4-phone__notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 22px;
  background: var(--card-2);
  border-radius: 0 0 14px 14px;
  z-index: 5;
}

.demo4-phone__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.demo4-phone__title { font-family: var(--font-heading); font-weight: 700; font-size: 16px; }
.demo4-phone__header svg { color: var(--text-muted); }

/* Feed */
.demo4-phone__feed {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
  position: relative;
}

.demo4-skel-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.demo4-skel {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--card-2) 25%, rgba(255,255,255,0.08) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: demo4-shimmer 1.4s ease-in-out infinite;
}
.demo4-skel--img { height: 64px; }
.demo4-skel--line { height: 9px; }
.demo4-skel--line.short { width: 60%; }
@keyframes demo4-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.demo4-phone__feed.is-loaded .demo4-skel-card { display: none; }

.demo4-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.demo4-card:not([hidden]).is-visible { opacity: 1; transform: none; }
.demo4-card__img {
  height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}
.demo4-card__title { font-size: 11.5px; color: var(--text-primary); line-height: 1.3; }
.demo4-card__price { font-family: var(--font-heading); font-weight: 700; font-size: 12.5px; color: var(--accent); }
.demo4-card__tag {
  align-self: flex-start;
  font-size: 9.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.demo4-card--new { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; }
.demo4-card--new .demo4-card__img { width: 56px; height: 56px; flex-shrink: 0; }
.demo4-card--new .demo4-card__title { font-size: 12.5px; }
.demo4-card__badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--accent);
  color: #131313;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

/* FAB */
.demo4-fab {
  position: absolute;
  right: 16px;
  bottom: 74px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #131313;
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(var(--accent-rgb), 0.4);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  z-index: 4;
}
.demo4-fab.is-active {
  box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0.18), 0 10px 24px rgba(var(--accent-rgb), 0.4);
  transform: scale(0.94);
}

/* Publish sheet */
.demo4-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px 20px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
  z-index: 6;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.6);
}
.demo4-sheet.is-open { transform: translateY(0); }
.demo4-sheet__title { font-family: var(--font-heading); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.demo4-sheet__photo {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.demo4-sheet__photo.is-filled { opacity: 1; border-color: rgba(var(--accent-rgb), 0.4); border-style: solid; color: var(--accent); }
.demo4-sheet__field { margin-bottom: 10px; }
.demo4-sheet__field label { display: block; font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.demo4-sheet__value {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: 12.5px;
  min-height: 16px;
}
.demo4-typewriter.is-typing::after {
  content: '';
  display: inline-block;
  width: 2px; height: 12px;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -2px;
  animation: demo1-caret-blink 0.9s step-end infinite;
}
.demo4-sheet__traces { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; min-height: 4px; }
.demo4-sheet__traces .demo1-trace { font-size: 10px; padding: 5px 10px; }
.demo4-sheet__traces .demo4-approved { color: #3ecf8e; font-size: 11.5px; font-weight: 600; }

/* Realtime toast */
.demo4-phone__toast {
  position: absolute;
  top: 30px; left: 10px; right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1), opacity 0.4s ease;
  z-index: 7;
}
.demo4-phone__toast.is-visible { transform: translateY(0); opacity: 1; }
.demo4-phone__toast-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.demo4-phone__toast-name { font-size: 11.5px; font-weight: 600; }
.demo4-phone__toast-msg { font-size: 11px; color: var(--text-secondary); }

/* Bottom nav */
.demo4-phone__nav {
  display: flex;
  border-top: 1px solid var(--border);
  padding: 10px 6px 14px;
  flex-shrink: 0;
}
.demo4-phone__nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  color: var(--text-muted);
  position: relative;
}
.demo4-phone__nav-item.is-active { color: var(--accent); }
.demo4-phone__badge {
  position: absolute;
  top: -4px; right: calc(50% - 20px);
  background: #e5484d;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 15px; height: 15px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.demo4-phone__badge.is-visible { opacity: 1; transform: scale(1); }

.demo4-continue-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.demo4-replay-row { display: flex; justify-content: center; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .demo4-skel { animation: none; }
  .demo4-typewriter.is-typing::after { animation: none; }
  .demo4-card,
  .demo4-fab,
  .demo4-sheet,
  .demo4-sheet__photo,
  .demo4-phone__toast,
  .demo4-phone__badge { transition: none; }
}

/* RESPONSIVE */
@media (max-width: 400px) {
  .demo4-phone { width: 100%; max-width: 340px; }
}
