/* ═══════════════════════════════════════════════════════════════
   PAGE DEMO — scène animée style Discord
   ═══════════════════════════════════════════════════════════════ */

.demo-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.demo-header { text-align: center; margin-bottom: 40px; }
.demo-title {
  font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 12px;
  color: var(--text);
}
.demo-title-accent {
  background: linear-gradient(120deg, #7C7CFF 0%, #A78BFA 60%, #EC4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.demo-sub { font-size: 16px; color: var(--text-soft); margin: 0; }

/* ═══ SCÈNE ═══ */
.demo-stage {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-areas:
    "sidebar chat"
    "sidebar controls";
  gap: 0;
  background: #313338;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  min-height: 480px;
}

.demo-sidebar {
  grid-area: sidebar;
  background: #1E1F22;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid rgba(255,255,255,0.04);
}
.ds-server {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ds-server-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C7CFF, #A78BFA);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.ds-server-name { font-size: 14px; font-weight: 600; color: #F2F3F5; }
.ds-channel {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #949BA4;
  cursor: default;
  transition: all .15s;
}
.ds-channel.active { background: rgba(255,255,255,.06); color: #F2F3F5; }

/* ═══ CHAT ═══ */
.demo-chat {
  grid-area: chat;
  background: #313338;
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 400px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.demo-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  color: #949BA4;
  font-size: 14px;
}
.demo-play-btn {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C7CFF, #A78BFA);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .2s ease;
  box-shadow: 0 12px 32px rgba(124,124,255,.4);
}
.demo-play-btn:hover { transform: scale(1.05); }
.demo-play-btn svg { margin-left: 4px; }

/* ═══ MESSAGE ═══ */
.dmsg {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  opacity: 0;
  transform: translateY(8px);
  animation: dmsgIn .35s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes dmsgIn {
  to { opacity: 1; transform: translateY(0); }
}

.dmsg-avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  background: #5865F2;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  object-fit: cover;
}
.dmsg-avatar.modex { background: linear-gradient(135deg, #7C7CFF, #A78BFF); }
.dmsg-avatar.user { background: #F97316; }
.dmsg-body { flex: 1; min-width: 0; }

.dmsg-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dmsg-name { font-size: 15px; font-weight: 600; color: #F2F3F5; }
.dmsg-tag {
  padding: 1px 5px;
  font-size: 10.5px; font-weight: 700;
  background: #5865F2; color: #fff;
  border-radius: 4px;
  vertical-align: 1px;
}
.dmsg-time { font-size: 12px; color: #949BA4; margin-left: 4px; }
.dmsg-text { font-size: 15px; color: #DBDEE1; line-height: 1.45; word-wrap: break-word; }
.dmsg-text code {
  padding: 1px 6px;
  background: #1E1F22;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13.5px;
  color: #A5A5FF;
}
.dmsg-text strong { color: #F2F3F5; font-weight: 600; }

.dmsg-typing::after {
  content: '...';
  animation: dots 1.4s steps(4, end) infinite;
  color: #949BA4;
}
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ═══ EMBED ═══ */
.dembed {
  margin-top: 6px;
  position: relative;
  background: #2B2D31;
  border-radius: 6px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  animation: dembedIn .4s .05s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes dembedIn {
  to { opacity: 1; transform: translateY(0); }
}
.dembed-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #7C7CFF;
}
.dembed-body { padding: 12px 14px 14px 16px; }
.dembed-title { font-size: 15.5px; font-weight: 700; color: #F2F3F5; margin-bottom: 6px; }
.dembed-desc { font-size: 14px; color: #DBDEE1; line-height: 1.5; }
.dembed-fields {
  display: flex; flex-wrap: wrap;
  gap: 20px;
  margin-top: 12px;
}
.dembed-field { min-width: 80px; }
.dembed-field-name { font-size: 11.5px; font-weight: 700; color: #F2F3F5; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.dembed-field-value { font-size: 14px; color: #DBDEE1; }
.dembed-footer {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px;
  font-size: 12px; color: #949BA4;
}
.dembed-footer-icon { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, #7C7CFF, #A78BFA); }
.dembed-image {
  margin-top: 12px;
  border-radius: 6px;
  height: 140px;
  background: linear-gradient(135deg, #7C7CFF 0%, #A78BFA 60%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.9);
  font-family: var(--font-display, sans-serif);
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}

/* Couleurs d'embed par thème */
.dembed[data-topic="levels"] .dembed-bar { background: #FBBF24; }
.dembed[data-topic="economy"] .dembed-bar { background: #10B981; }
.dembed[data-topic="ticket"] .dembed-bar { background: #7C7CFF; }
.dembed[data-topic="ai"] .dembed-bar { background: #EC4899; }
.dembed[data-topic="rep"] .dembed-bar { background: #F472B6; }

/* Réactions */
.dreactions { display: flex; gap: 6px; margin-top: 8px; }
.dreaction {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  font-size: 12px; color: #DBDEE1;
  opacity: 0;
  animation: dreactIn .3s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes dreactIn {
  to { opacity: 1; }
}

/* ═══ CONTROLS ═══ */
.demo-controls {
  grid-area: controls;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: #2B2D31;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.demo-ctrl {
  width: 32px; height: 32px;
  border: 0; padding: 0;
  background: transparent;
  color: #949BA4;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.demo-ctrl:hover { background: rgba(255,255,255,.06); color: #F2F3F5; }
.demo-progress {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
}
.demo-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7C7CFF, #A78BFA);
  transition: width .3s ease;
}
.demo-step {
  font-size: 12px;
  color: #949BA4;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}

/* ═══ SCÉNARIOS ═══ */
.demo-scenarios {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}
.demo-scenario {
  padding: 18px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all .25s ease;
}
.demo-scenario.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface));
  transform: translateY(-2px);
}
.ds-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}
.demo-scenario.active .ds-num {
  background: var(--accent);
  color: #fff;
}
.ds-title { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ds-desc { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }

.demo-footer { text-align: center; margin-top: 60px; }
.demo-footer p { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 20px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .demo-scenarios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .demo-page { padding: 24px 16px 60px; }
  .demo-stage {
    grid-template-columns: 1fr;
    grid-template-areas: "chat" "controls";
    min-height: 420px;
  }
  .demo-sidebar { display: none; }
  .demo-chat { min-height: 340px; padding: 16px 14px; }
  .demo-scenarios { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dmsg-text { font-size: 14px; }
  .dmsg-avatar { width: 34px; height: 34px; }
}

/* ═══════════════════════════════════════════════════════════════
   TYPING + REACTIONS (nouvelles classes)
   ═══════════════════════════════════════════════════════════════ */

/* Ligne de typing */
.dmsg-typing {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  background: #2B2D31;
  border-radius: 12px;
  margin-top: 4px;
}
.dmsg-typing::before,
.dmsg-typing::after,
.dmsg-typing > i {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #949BA4;
  display: inline-block;
  animation: dtyping 1.3s ease-in-out infinite;
}
.dmsg-typing::before { animation-delay: 0s; }
.dmsg-typing::after  { animation-delay: .3s; }
.dmsg-typing > i { animation-delay: .15s; }
@keyframes dtyping {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-4px); }
}

/* Ligne de réactions */
.dmsg-reactions-row .dmsg-body {
  padding-left: 52px;
  margin-top: -4px;
}
.dreactions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dreaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(124,124,255,.1);
  border: 1px solid rgba(124,124,255,.35);
  border-radius: 999px;
  font-size: 13px;
  color: #DBDEE1;
  cursor: default;
  animation: dreactIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
  transform: scale(.85);
  opacity: 0;
}
.dreaction:hover {
  background: rgba(124,124,255,.2);
  border-color: rgba(124,124,255,.6);
}
@keyframes dreactIn {
  to { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════
   TRANSITIONS entre scénarios (slide gauche/droite)
   ═══════════════════════════════════════════════════════════════ */
.demo-chat {
  overflow-x: hidden;
  position: relative;
}
.demo-chat.dchat-slide-out {
  animation: dchatOut .38s cubic-bezier(.4,0,.9,1) forwards;
}
@keyframes dchatOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(-40px); opacity: 0; }
}
.demo-chat.dchat-slide-in {
  animation: dchatIn .5s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes dchatIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Compteur scénario animé */
.demo-step {
  transition: transform .25s ease, color .25s ease;
}
.demo-step.changing {
  transform: scale(1.15);
  color: #A5A5FF;
}

/* ═══════════════════════════════════════════════════════════════
   PLEIN ÉCRAN : la scène prend tout l'écran
   ═══════════════════════════════════════════════════════════════ */
.demo-stage:fullscreen {
  background: #0B0B10;
  padding: 0;
  border-radius: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-areas:
    "sidebar chat"
    "sidebar controls";
}
.demo-stage:-webkit-full-screen {
  background: #0B0B10;
  border-radius: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-areas:
    "sidebar chat"
    "sidebar controls";
}
.demo-stage:fullscreen .demo-chat {
  min-height: auto;
  height: auto;
}
.demo-stage:fullscreen .demo-sidebar {
  padding: 20px 12px;
}

@media (max-width: 720px) {
  .demo-stage:fullscreen,
  .demo-stage:-webkit-full-screen {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chat"
      "controls";
  }
}
