html[data-demo-device="desktop"] body,
html[data-demo-device="tablet"] body,
html[data-demo-device="mobile"] body,
body.demo-desktop,
body.demo-tablet,
body.demo-mobile {
  transition: max-width 0.25s ease, margin 0.25s ease, padding 0.25s ease;
}

body.demo-preview-enabled {
  padding-top: 68px;
  min-height: 100vh;
}

/* When the demo topbar is present, push page content down so toolbar doesn't cover it */
.has-demo-topbar {
  padding-top: 58px;
}

/* When a page uses a fixed header (like .nav), push it down so topbar doesn't cover it */
.has-demo-topbar .nav,
.has-demo-topbar header.nav {
  top: 58px !important;
  transition: top 0.18s ease;
}

body.demo-preview-enabled > :not(#demo-preview-topbar):not(#demo-preview-frame) {
  display: none !important;
}

#demo-preview-frame {
  display: flex;
  justify-content: center;
  padding: 0;
  background: transparent;
}

#demo-preview-frame iframe {
  width: 100%;
  max-width: 1200px;
  min-width: 320px;
  min-height: calc(100vh - 96px);
  border: none;
  border-radius: 22px;
  box-shadow: none;
  background: transparent;
}

.preview-frame.tablet,
.preview-frame.mobile {
  background: #f6f6f6;
  padding: 28px 0 40px;
}

.preview-frame.tablet iframe,
.preview-frame.mobile iframe {
  border: 5px solid #0f172a;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  background: #fff;
  max-width: 95%;
}

.preview-frame.desktop iframe {
  border: none;
  box-shadow: none;
  background: transparent;
  max-width: 1200px;
}

.preview-frame.desktop {
  background: transparent;
  padding: 0;
}

#demo-preview-topbar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 58px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

#demo-preview-topbar .demo-preview-brand {
  position: absolute;
  left: 18px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#demo-preview-topbar .demo-preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#demo-preview-topbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  min-width: 88px;
  height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

#demo-preview-topbar button:hover,
#demo-preview-topbar button.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

html, body {
  min-width: 0;
}

body.demo-desktop,
body.demo-tablet,
body.demo-mobile {
  margin: 0 auto;
  max-width: 100%;
}

body.demo-preview-enabled {
  overflow-x: hidden;
}

@media (max-width: 767px) {
  #demo-preview-topbar,
  #demo-preview-frame {
    display: none !important;
  }
}

@media (max-width: 480px) {
  #demo-preview-topbar {
    padding: 0 12px;
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
  }

  #demo-preview-topbar .demo-preview-brand {
    flex: 1 1 100%;
    text-align: center;
  }

  #demo-preview-topbar .demo-preview-controls {
    justify-content: center;
    width: 100%;
  }
}
