/* ---- DEVICE DEMO ---- */
.demo-section {
  --bg: #050a14; /* Match site bg */
  --surface: #0e1117;
  --surface2: #161b24;
  --border: rgba(255,255,255,0.1);
  --accent: #00f2ff; /* Match primary-color */
  --accent2: #bd00ff; /* Match secondary-color */
  --success: #00e676;
  --text-muted: #a0a0a0;
  --font-mono: 'Courier New', Courier, monospace;

  padding: 0;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.demo-canvas {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 420px;
}

.device-phone {
  width: 200px;
  height: 400px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 28px;
  position: relative;
  z-index: 2;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.03);
  overflow: hidden;
}

.device-phone .notch {
  width: 80px;
  height: 22px;
  background: var(--bg);
  border-radius: 0 0 14px 14px;
  margin: 0 auto;
  position: relative;
  z-index: 3;
}

.phone-screen {
  margin: 8px;
  border-radius: 20px;
  overflow: hidden;
  height: calc(100% - 16px);
  background: linear-gradient(180deg, #1a1f2e, #0d1117);
  position: relative;
}

.phone-content {
  padding: 2rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.phone-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
}

.phone-bar.w60 { width: 60%; }
.phone-bar.w80 { width: 80%; }
.phone-bar.w40 { width: 40%; }
.phone-bar.accent { background: rgba(0,242,255,.2); }

.phone-img {
  width: 100%;
  height: 100px;
  border-radius: 10px;
  margin-top: .5rem;
  background: linear-gradient(135deg, rgba(0,242,255,.15), rgba(189,0,255,.15));
}

.phone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-top: .5rem;
}

.phone-grid-item {
  height: 50px;
  border-radius: 8px;
  background: var(--border);
}

/* Screen mirror animation on phone */
.mirror-scan {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 3s ease-in-out infinite;
  z-index: 5;
}

@keyframes scan {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Connection beam */
.connection-beam {
  flex: 1;
  height: 3px;
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: .6;
}

.connection-beam::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 20px var(--accent);
  animation: beam-travel 2s ease-in-out infinite;
}

@keyframes beam-travel {
  0% { left: 0; }
  100% { left: calc(100% - 20px); }
}

.connection-beam .particles {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
}

.demo-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: particle-fly 2s ease-out infinite;
}

.demo-particle:nth-child(1) { animation-delay: 0s; }
.demo-particle:nth-child(2) { animation-delay: .5s; }
.demo-particle:nth-child(3) { animation-delay: 1s; }
.demo-particle:nth-child(4) { animation-delay: 1.5s; }

@keyframes particle-fly {
  0% { left: 0; opacity: 1; transform: translateY(-50%) scale(1); }
  100% { left: 100%; opacity: 0; transform: translateY(-50%) scale(.3); }
}

.monitor-wrapper {
  flex-shrink: 0;
}

/* Monitor */
.device-monitor {
  width: 360px;
  height: 260px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 14px;
  position: relative;
  z-index: 2;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.03);
  overflow: hidden;
}

.monitor-bar {
  height: 28px;
  background: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  gap: .4rem;
  border-bottom: 1px solid var(--border);
}

.monitor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.monitor-dot.r { background: #ff5f57; }
.monitor-dot.y { background: #febc2e; }
.monitor-dot.g { background: #28c840; }

.monitor-screen {
  padding: 12px;
  height: calc(100% - 28px);
  overflow: hidden;
}

.monitor-content {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1f2e, #0d1117);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1rem;
}

.monitor-content .phone-bar { height: 6px; }
.monitor-content .phone-img { height: 70px; }
.monitor-content .phone-grid-item { height: 35px; }

/* Stand */
.device-stand {
  width: 60px;
  height: 40px;
  margin: 0 auto;
  margin-top: -2px;
  z-index: 1;
  background: linear-gradient(180deg, var(--border), var(--surface2));
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
}

.device-base {
  width: 120px;
  height: 6px;
  margin: 0 auto;
  border-radius: 3px;
  background: var(--border);
}

/* Status indicators */
.status-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-item .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-item .indicator.on {
  background: var(--success);
  box-shadow: 0 0 8px rgba(0,230,118,.5);
}

.status-item .indicator.latency {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0,242,255,.5);
}

/* Responsive */
@media(max-width: 1200px) and (min-width: 993px) {
  .demo-canvas {
    transform: scale(0.8);
    transform-origin: center;
  }
}
@media(max-width: 768px) {
  .demo-canvas {
    flex-direction: column;
    gap: 1rem;
  }
  .connection-beam {
    width: 3px;
    height: 60px;
    flex: none;
  }
  .connection-beam::before {
    animation: beam-travel-v 2s ease-in-out infinite;
  }
  @keyframes beam-travel-v {
    0% { top: 0; left: 50%; transform: translateX(-50%); }
    100% { top: 100%; left: 50%; transform: translateX(-50%); }
  }
  .device-phone {
    width: 160px;
    height: 320px;
  }
  .device-monitor {
    width: 280px;
    height: 200px;
  }
}
