/* ============================================================
   Interactive product demo — modal + simulated app UI
   ============================================================ */

/* --- Make product cards feel clickable --- */
.programs-sub {
  margin: 6px auto 22px;
  max-width: 560px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.demo-card {
  cursor: pointer;
  position: relative;
  outline: none;
}

.demo-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 117, 255, 0.35);
}

.program-grid .demo-cta {
  display: inline-block;
  width: auto;
  height: auto;
  margin: 10px auto 0;
  padding: 0;
  border-radius: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  opacity: 0.85;
  transition: transform 200ms ease, opacity 200ms ease;
}

.demo-card:hover .demo-cta,
.demo-card:focus-visible .demo-cta {
  transform: translateX(3px);
  opacity: 1;
}

/* ============================================================
   Modal shell
   ============================================================ */
.demo-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.demo-modal.open {
  display: flex;
}

.demo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 50, 0.55);
  backdrop-filter: blur(4px);
  animation: demoFade 220ms ease;
}

.demo-dialog {
  position: relative;
  width: min(960px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #f3f7ff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(10, 20, 50, 0.45);
  animation: demoPop 280ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes demoFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes demoPop {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1b2a55, #2a3e7d);
  color: #fff;
}

.demo-head-meta { display: flex; align-items: center; gap: 12px; }

.demo-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.demo-head h3 { margin: 0; font-size: 17px; }
.demo-head p { margin: 2px 0 0; font-size: 13px; opacity: 0.7; }

.demo-head-actions { display: flex; align-items: center; gap: 8px; }

.demo-replay,
.demo-x {
  border: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  font-weight: 700;
  transition: background 180ms ease;
}
.demo-replay { padding: 8px 12px; font-size: 13px; }
.demo-x { width: 34px; height: 34px; font-size: 20px; line-height: 1; }
.demo-replay:hover, .demo-x:hover { background: rgba(255, 255, 255, 0.28); }

/* ============================================================
   Stage — the simulated app screen
   ============================================================ */
.demo-stage {
  position: relative;
  flex: 1;
  min-height: 380px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 100% 0%, #eaf1ff 0%, #f3f7ff 60%),
    #f3f7ff;
  padding: 18px;
}

/* Virtual cursor that drives the simulation */
.sim-cursor {
  position: absolute;
  top: 0; left: 0;
  width: 22px;
  height: 22px;
  z-index: 50;
  pointer-events: none;
  transform: translate(40px, 40px);
  transition: transform 650ms cubic-bezier(0.45, 0.05, 0.2, 1);
  background: no-repeat center/contain
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 2l6 16 2.5-6.5L19 9z' fill='%230a1a44' stroke='white' stroke-width='1.4' stroke-linejoin='round'/></svg>");
  filter: drop-shadow(0 3px 6px rgba(10, 20, 50, 0.35));
}
.sim-cursor.click::after {
  content: "";
  position: absolute;
  left: -8px; top: -8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  animation: simRipple 450ms ease-out;
}
@keyframes simRipple {
  from { transform: scale(0.3); opacity: 0.8; }
  to   { transform: scale(1.4); opacity: 0; }
}

/* ============================================================
   Generic simulated-UI primitives (shared across scenarios)
   ============================================================ */
.sim-app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(45, 64, 130, 0.12);
  overflow: hidden;
}

.sim-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
}
.sim-topbar .dot { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.sim-topbar .dot.y { background: #febc2e; }
.sim-topbar .dot.g { background: #28c840; }
.sim-topbar .sim-title { margin-left: 6px; }
.sim-topbar .sim-spacer { flex: 1; }
.sim-topbar .sim-pill {
  font-size: 11px; font-weight: 700; color: var(--blue);
  background: rgba(37,117,255,0.1); padding: 4px 10px; border-radius: 999px;
}

.sim-body { flex: 1; display: flex; min-height: 0; }

.sim-side {
  width: 150px;
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  background: #fafcff;
  font-size: 12.5px;
}
.sim-side .nav-item {
  padding: 8px 10px; border-radius: 9px; color: var(--muted);
  font-weight: 600; margin-bottom: 3px; transition: all 180ms ease;
}
.sim-side .nav-item.active { background: rgba(37,117,255,0.12); color: var(--blue); }

.sim-main { flex: 1; padding: 16px 18px; overflow: hidden; }
.sim-h { font-size: 15px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.sim-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

/* Quiz primitives */
.sim-q { font-size: 14.5px; font-weight: 700; color: var(--ink); margin: 0 0 14px; line-height: 1.4; }
.sim-options { display: grid; gap: 9px; }
.sim-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 13.5px; color: var(--ink); background: #fff;
  transition: border-color 180ms ease, background 180ms ease, transform 120ms ease;
}
.sim-opt .key {
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: #eef3ff; color: var(--blue);
}
.sim-opt.hover { border-color: rgba(37,117,255,0.5); background: #f7faff; }
.sim-opt.selected { border-color: var(--blue); background: rgba(37,117,255,0.08); }
.sim-opt.correct { border-color: #18b27a; background: rgba(24,178,122,0.12); }
.sim-opt.correct .key { background: #18b27a; color: #fff; }
.sim-opt.wrong { border-color: #e5484d; background: rgba(229,72,77,0.1); }

.sim-btn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px; padding: 11px 20px; border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff; font-weight: 700; font-size: 13.5px; border: 0;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.sim-btn.press { transform: scale(0.95); box-shadow: 0 6px 18px rgba(37,117,255,0.4); }

/* Progress + result */
.sim-progress { height: 8px; border-radius: 999px; background: #e7eefc; overflow: hidden; margin-bottom: 14px; }
.sim-progress > span { display: block; height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width 700ms cubic-bezier(0.3,0.8,0.3,1); }

.sim-result { text-align: center; padding: 10px 0; animation: demoFade 400ms ease; }
.sim-score { font-size: 44px; font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sim-result .label { font-size: 13px; color: var(--muted); }
.sim-chips { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.sim-chip { font-size: 12px; font-weight: 700; padding: 7px 13px; border-radius: 999px; background: #eef3ff; color: var(--ink); }
.sim-chip.ok { background: rgba(24,178,122,0.14); color: #0f9a66; }

/* Cards grid (content portal, dashboard tours) */
.sim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.sim-tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; transition: transform 180ms ease, box-shadow 180ms ease; }
.sim-tile.hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(45,64,130,0.14); border-color: rgba(37,117,255,0.4); }
.sim-tile .thumb { height: 56px; border-radius: 8px; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--violet)); opacity: 0.85; }
.sim-tile.t2 .thumb { background: linear-gradient(135deg, var(--gold), var(--pink)); }
.sim-tile.t3 .thumb { background: linear-gradient(135deg, var(--teal), var(--blue)); }
.sim-tile .tt { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.sim-tile .ts { font-size: 11px; color: var(--muted); }

/* Chat (AI learning) */
.sim-chat { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.sim-msgs { flex: 1; display: flex; flex-direction: column; gap: 9px; overflow: hidden; }
.sim-bubble { max-width: 78%; padding: 10px 13px; border-radius: 13px; font-size: 13px; line-height: 1.45; animation: demoPop 300ms ease; }
.sim-bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; border-bottom-right-radius: 4px; }
.sim-bubble.bot { align-self: flex-start; background: #eef3ff; color: var(--ink); border-bottom-left-radius: 4px; }
.sim-typing { display: inline-flex; gap: 4px; }
.sim-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: simBlink 1s infinite; }
.sim-typing i:nth-child(2) { animation-delay: 0.15s; }
.sim-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes simBlink { 0%,60%,100% { opacity: 0.25; } 30% { opacity: 1; } }

/* ============================================================
   Phone frame (mobile demo) — realistic device chrome
   ============================================================ */
.sim-phone-wrap { height: 100%; display: grid; place-items: center; padding: 4px; }
/* ---- iPhone-accurate frame ---- */
.sim-phone {
  position: relative;
  width: 200px; height: 408px;          /* ~19.5:9 aspect like a real iPhone */
  border-radius: 42px;
  padding: 5px;                          /* thin, uniform titanium bezel */
  background:
    linear-gradient(145deg, #3a3f4a 0%, #1b1e26 30%, #2c313c 60%, #15181f 100%);
  box-shadow:
    0 30px 70px rgba(10,20,50,0.45),
    inset 0 0 0 1.5px rgba(255,255,255,0.10),
    inset 0 0 0 6px #07090e;             /* inner black antenna band */
}
/* side buttons — titanium rail */
.sim-phone .btn-rail { position:absolute; background:#23262e; border-radius:2px; }
.sim-phone .btn-rail.power { right:-2.5px; top:118px; width:2.5px; height:54px; }
.sim-phone .btn-rail.vol-up { left:-2.5px; top:96px; width:2.5px; height:34px; }
.sim-phone .btn-rail.vol-dn { left:-2.5px; top:138px; width:2.5px; height:34px; }
.sim-phone .btn-rail.action { left:-2.5px; top:64px; width:2.5px; height:22px; }
.sim-phone .screen {
  position: relative; background: #f4f7fd;
  border-radius: 37px; height: 100%; overflow: hidden;
  display: flex; flex-direction: column;
}
/* Dynamic Island */
.sim-phone .notch {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 66px; height: 20px; border-radius: 999px; background: #05070b; z-index: 8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.sim-phone .notch::after {  /* front camera dot */
  content:""; position:absolute; right:9px; top:50%; transform:translateY(-50%);
  width:7px; height:7px; border-radius:50%;
  background: radial-gradient(circle at 35% 35%, #2b3550, #05070b 70%);
  box-shadow: inset 0 0 1px rgba(120,160,255,0.5);
}
/* home indicator */
.sim-phone .home-ind {
  position:absolute; bottom:7px; left:50%; transform:translateX(-50%);
  width:96px; height:4px; border-radius:999px; background:#0a1024; opacity:0.32; z-index:7;
}
/* status bar */
.sim-phone .statusbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 3px; font-size: 11px; font-weight: 700; color: var(--ink); }
.sim-phone .statusbar .sig { display: inline-flex; gap: 3px; align-items: center; }
.sim-phone .statusbar .sig b { display:inline-block; width:3px; border-radius:1px; background: var(--ink); }
.sim-phone .statusbar .sig b:nth-child(1){height:5px} .sim-phone .statusbar .sig b:nth-child(2){height:7px} .sim-phone .statusbar .sig b:nth-child(3){height:9px} .sim-phone .statusbar .sig b:nth-child(4){height:11px}
.sim-phone .statusbar .batt { display:inline-flex; align-items:center; gap:4px; }
.sim-phone .statusbar .batt .cell { width:18px; height:9px; border:1.4px solid var(--ink); border-radius:3px; position:relative; }
.sim-phone .statusbar .batt .cell::before { content:""; position:absolute; inset:1.4px; width:72%; background: var(--ink); border-radius:1px; }
.sim-phone .statusbar .batt .cell::after { content:""; position:absolute; right:-3px; top:2.5px; width:1.6px; height:4px; background:var(--ink); border-radius:1px; }
.sim-phone .p-head { padding: 4px 16px 6px; }
.sim-phone .p-head .hi { font-size: 14px; font-weight: 800; color: var(--ink); }
.sim-phone .p-head .sub { font-size: 10.5px; color: var(--muted); }
.sim-phone .p-body { flex: 1; padding: 2px 13px 6px; overflow: hidden; }
/* bottom tab bar — extra bottom padding clears the home indicator */
.sim-phone .tabbar { display: flex; justify-content: space-around; padding: 8px 6px 16px; background: #fff; border-top: 1px solid var(--line); }
.sim-phone .tabbar .tab { display: grid; place-items: center; gap: 2px; font-size: 9px; font-weight: 700; color: #aab4cc; }
.sim-phone .tabbar .tab .ic { font-size: 16px; line-height: 1; }
.sim-phone .tabbar .tab.active { color: var(--blue); }
/* lesson list card */
.m-card { display: flex; gap: 10px; align-items: center; padding: 9px; border-radius: 13px; background: #fff; border: 1px solid var(--line); margin-bottom: 9px; transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.m-card.hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(45,64,130,0.14); border-color: rgba(37,117,255,0.4); }
.m-card .mt { width: 46px; height: 46px; flex: none; border-radius: 11px; display:grid; place-items:center; color:#fff; font-size:18px; background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.m-card.c2 .mt { background: linear-gradient(135deg, var(--gold), var(--pink)); }
.m-card.c3 .mt { background: linear-gradient(135deg, var(--teal), var(--blue)); }
.m-card .mtxt b { display:block; font-size:12.5px; color:var(--ink); }
.m-card .mtxt span { font-size:10.5px; color:var(--muted); }
/* video player (mobile) */
.m-video { position: relative; height: 132px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #14306b, #6d4eff); display:grid; place-items:center; }
.m-video .play { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,0.92); display:grid; place-items:center; color: var(--blue); font-size: 18px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); transition: transform 200ms ease, opacity 200ms ease; }
.m-video.playing .play { transform: scale(0.6); opacity: 0; }
.m-video .scrub { position:absolute; left:10px; right:10px; bottom:10px; height:4px; border-radius:999px; background:rgba(255,255,255,0.3); }
.m-video .scrub > i { display:block; height:100%; width:0%; border-radius:999px; background:#fff; transition: width 2.4s linear; }
.m-video .time { position:absolute; right:10px; bottom:18px; font-size:10px; color:#fff; font-weight:700; }

/* ============================================================
   Desktop app window — realistic OS window chrome
   ============================================================ */
.sim-win {
  height: 100%;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 22px 60px rgba(10,20,50,0.22);
  border: 1px solid #dce4f4;
}
.win-bar { display:flex; align-items:center; gap:10px; padding: 9px 12px; background: linear-gradient(#eef2fa,#e6ecf8); border-bottom:1px solid #d6deee; }
.win-bar .traffic { display:flex; gap:7px; }
.win-bar .traffic i { width:11px; height:11px; border-radius:50%; display:block; }
.win-bar .traffic .r{background:#ff5f57} .win-bar .traffic .y{background:#febc2e} .win-bar .traffic .g{background:#28c840}
.win-bar .wtitle { font-size:12px; font-weight:700; color:#41506f; margin:0 auto; transform: translateX(-18px); }
.win-menu { display:flex; gap:14px; padding:6px 14px; background:#fafbfe; border-bottom:1px solid var(--line); font-size:11.5px; color:#56627d; font-weight:600; }
.win-menu span:hover { color: var(--blue); }
.win-body { flex:1; display:flex; min-height:0; }
.win-tools { width: 132px; border-right:1px solid var(--line); padding:10px; background:#fbfcff; }
.win-tools .th { font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:#9aa5bd; font-weight:800; margin:4px 2px 8px; }
.tool-chip { display:flex; align-items:center; gap:8px; padding:8px 9px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:12px; font-weight:600; color:var(--ink); margin-bottom:7px; cursor:default; transition: all 160ms ease; }
.tool-chip .ic { font-size:15px; }
.tool-chip.hover { border-color: rgba(37,117,255,0.5); background:#f6f9ff; }
.tool-chip.used { opacity:.45; }
/* canvas / breadboard */
.win-canvas { flex:1; position:relative; padding:14px; background:
  radial-gradient(circle at 1px 1px, #dde6f6 1px, transparent 0) 0 0/18px 18px, #f5f8fe; }
.win-canvas .ctitle { font-size:11px; color:var(--muted); font-weight:700; margin:0 0 6px; }
.circuit { position:relative; width:100%; height:calc(100% - 22px); }
/* placed nodes */
.cnode { position:absolute; width:58px; height:46px; border-radius:10px; background:#fff; border:1.6px solid #cdd7ea; display:grid; place-items:center; font-size:20px; box-shadow:0 4px 10px rgba(45,64,130,0.08); opacity:0; transform: scale(.6); transition: opacity 260ms ease, transform 260ms cubic-bezier(.2,.9,.3,1.3); }
.cnode.show { opacity:1; transform: scale(1); }
.cnode .lbl { position:absolute; bottom:-15px; left:50%; transform:translateX(-50%); font-size:9px; font-weight:700; color:var(--muted); white-space:nowrap; }
.cnode.batt { left:14%; top:42%; }
.cnode.bulb { right:14%; top:42%; }
.cnode.bulb.lit { border-color:#f8b938; box-shadow:0 0 0 4px rgba(248,185,56,.25), 0 0 26px 6px rgba(248,185,56,.55); background:#fffaf0; }
/* connecting wire */
.cwire { position:absolute; height:3px; border-radius:3px; background:#cdd7ea; transition: background 300ms ease; }
.cwire.top { left:18%; right:18%; top:32%; }
.cwire.left { left:18%; top:32%; bottom:40%; width:3px; height:auto; }
.cwire.right { right:18%; top:32%; bottom:40%; width:3px; height:auto; }
.cwire.live { background: linear-gradient(90deg, var(--gold), #ff8a3d); box-shadow:0 0 8px rgba(248,185,56,.6); }
/* current flow dot */
.spark { position:absolute; width:7px; height:7px; border-radius:50%; background:#fff; box-shadow:0 0 8px 2px var(--gold); opacity:0; }
.spark.run { animation: sparkMove 1.4s linear infinite; opacity:1; }
@keyframes sparkMove {
  0%{ left:18%; top:31%; } 45%{ left:82%; top:31%; }
  50%{ left:82%; top:55%; } 95%{ left:18%; top:55%; } 100%{ left:18%; top:31%; }
}
.win-status { display:flex; align-items:center; gap:12px; padding:7px 14px; border-top:1px solid var(--line); background:#fafbfe; font-size:11px; color:var(--muted); }
.win-status .live { color:#0f9a66; font-weight:700; }
.win-status .run-btn { margin-left:auto; }

/* ============================================================
   Footer: steps + caption
   ============================================================ */
.demo-foot { padding: 12px 20px 16px; background: #fff; border-top: 1px solid var(--line); }
.demo-steps { display: flex; gap: 6px; margin-bottom: 8px; }
.demo-steps .step { flex: 1; height: 4px; border-radius: 999px; background: #e3e9f8; transition: background 280ms ease; }
.demo-steps .step.done { background: var(--blue); }
.demo-steps .step.active { background: linear-gradient(90deg, var(--blue), var(--violet)); }
.demo-caption { margin: 0; font-size: 13px; color: var(--ink); font-weight: 600; min-height: 18px; }
.demo-caption .muted { color: var(--muted); font-weight: 500; }

@media (max-width: 720px) {
  .demo-modal { padding: 12px; }
  .demo-stage { min-height: 320px; padding: 12px; }
  .sim-side { display: none; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
}
