/* ==========================================================================
   Leadstart Smart Demo Bar — modern replacement for the old DemoBar header.
   Always dark: hard-coded palette, never follows the site light/dark mode.
   Bar styles are scoped under #ls-demobar; preview stage under .db-stage.
   Two run modes, detected automatically by the JS:
     - Host mode (standalone index.php): .db-stage + #frame exist, device
       buttons resize the stage iframe.
     - Embedded mode (wp-demo-bar.php on leadstart.org): no stage exists,
       device buttons open a device-size overlay preview of the current page.
   No dependencies. Drop into: inc/assets/css/demo-bar.css (Leadstart theme)
   ========================================================================== */

:root {
  --db-bar-h: 53px; /* bar height + bottom border, used by the stage */
}

body {
  margin: 0;
  background: #0b0d10;
}

/* -------------------------------------------------------------------------- */
/* Embedded mode: keep the page clear of the fixed bar.                        */
/* (JS adds .ls-demo-bar-active to <body> whenever the bar is present.)       */
/* -------------------------------------------------------------------------- */

body.ls-demo-bar-active {
  padding-top: var(--db-bar-h);
  transition: padding-top 0.28s ease;
}

body.ls-demo-bar-active[data-db-collapsed="true"] {
  padding-top: 0;
}

/* WordPress admin bar sits above the demo bar */

body.admin-bar #ls-demobar {
  top: 32px;
}

body.admin-bar.ls-demo-bar-active {
  padding-top: calc(32px + var(--db-bar-h));
}

body.admin-bar.ls-demo-bar-active[data-db-collapsed="true"] {
  padding-top: 32px;
}

/* -------------------------------------------------------------------------- */
/* The bar                                                                     */
/* -------------------------------------------------------------------------- */

#ls-demobar {
  --db-bg: #0d0f13;
  --db-surface: #14171d;
  --db-surface-2: #1b1f27;
  --db-border: #262b34;
  --db-text: #e8eaef;
  --db-muted: #9aa1ad;
  --db-accent: #635bff;
  --db-accent-press: #524be6;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: var(--db-bg);
  border-bottom: 1px solid var(--db-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color: var(--db-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  color-scheme: dark;
  transform: translateY(0);
  transition: transform 0.28s ease;
}

#ls-demobar[data-collapsed="true"] {
  transform: translateY(-101%);
}

#ls-demobar,
#ls-demobar *,
#ls-demobar *::before,
#ls-demobar *::after {
  box-sizing: border-box;
}

#ls-demobar button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

#ls-demobar svg {
  display: block;
  flex: none;
}

#ls-demobar button:focus-visible,
#ls-demobar a:focus-visible,
#ls-demobar input:focus-visible {
  outline: 2px solid var(--db-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.db-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px;
}

/* generic buttons */

.db-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--db-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.db-icon-btn:hover {
  background: var(--db-surface-2);
  color: var(--db-text);
}

.db-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--db-muted);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.db-btn:hover {
  background: var(--db-surface-2);
  color: var(--db-text);
}

.db-btn.is-active,
.db-icon-btn.is-active,
.db-btn[aria-pressed="true"] {
  background: var(--db-surface-2);
  color: var(--db-text);
}

/* demo switcher button (current theme or plugin) */

.db-demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  color: var(--db-text);
  max-width: 46vw;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.db-demo-btn:hover {
  background: var(--db-surface-2);
  border-color: #313743;
}

.db-demo-btn .db-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.db-demo-btn .chev {
  color: var(--db-muted);
  transition: transform 0.2s ease;
}

.db-demo-btn[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

/* type chip: Plugin / Theme */

.db-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.db-flex {
  flex: 1 1 auto;
}

/* purchase */

.db-buy {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  background: var(--db-accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.db-buy:hover {
  background: var(--db-accent-press);
}

/* -------------------------------------------------------------------------- */
/* Popovers (demo chooser + device chooser) — open on click                    */
/* -------------------------------------------------------------------------- */

.db-pop {
  position: absolute;
  top: calc(100% + 8px);
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  color: var(--db-text);
  z-index: 1;
}

.db-pop-demos {
  left: 12px;
  width: min(600px, calc(100vw - 24px));
}

.db-pop-devices {
  right: 12px;
  width: min(520px, calc(100vw - 24px));
}

.db-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--db-border);
  color: var(--db-muted);
}

#db-filter {
  flex: 1;
  background: var(--db-surface-2);
  border: 1px solid var(--db-border);
  border-radius: 8px;
  height: 32px;
  padding: 0 10px;
  color: var(--db-text);
  font: inherit;
}

#db-filter::placeholder {
  color: var(--db-muted);
}

#db-filter:focus {
  border-color: var(--db-accent);
  outline: none;
}

/* demo cards: one card per theme or plugin */

.db-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  max-height: min(60vh, 420px);
  overflow: auto;
}

.db-demo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--db-surface-2);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--db-text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.db-demo-card:hover {
  border-color: var(--db-accent);
}

.db-demo-card.is-current {
  border-color: var(--db-accent);
  background: rgba(99, 91, 255, 0.12);
}

.db-demo-card.is-soon {
  opacity: 0.55;
  cursor: default;
}

.db-demo-card.is-soon:hover {
  border-color: transparent;
}

.db-card-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-demo-card .db-chip {
  height: 18px;
  padding: 0 7px;
  font-size: 10px;
  flex: none;
}

.db-empty {
  grid-column: 1 / -1;
  padding: 14px 12px;
  color: var(--db-muted);
  font-size: 12.5px;
  text-align: center;
}

.db-empty[hidden] {
  display: none;
}

/* device chooser */

.db-dev-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.db-dev-cols h4 {
  margin: 0;
  padding: 12px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--db-muted);
}

.db-dev-list {
  list-style: none;
  margin: 0;
  padding: 4px 8px 10px;
}

.db-dev {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--db-text);
  transition: background 0.15s ease;
}

.db-dev:hover {
  background: var(--db-surface-2);
}

.db-dev.is-active {
  background: rgba(99, 91, 255, 0.15);
  font-weight: 600;
}

.db-dev span {
  color: var(--db-muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* Preview stage (host mode)                                                   */
/* -------------------------------------------------------------------------- */

.db-stage {
  position: fixed;
  inset: 0;
  top: var(--db-bar-h);
  display: flex;
  overflow: auto;
  padding: 20px;
  transition: top 0.28s ease;
}

body[data-db-collapsed="true"] .db-stage {
  top: 0;
}

body.admin-bar .db-stage {
  top: calc(32px + var(--db-bar-h));
}

body.admin-bar[data-db-collapsed="true"] .db-stage {
  top: 32px;
}

.db-bezel {
  margin: auto; /* centers and prevents clipping when scrolling */
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  background: none;
  border: 0;
  padding: 0;
}

.db-stage[data-device="desktop"] .db-bezel {
  width: 100%;
  height: 100%;
}

.db-stage[data-device="phone"] .db-bezel,
.db-stage[data-device="tablet"] .db-bezel {
  width: fit-content;
  height: fit-content;
  flex: none;
  background: #101318;
  border: 1px solid #2a303b;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
}

.db-stage[data-device="phone"] .db-bezel {
  padding: 10px;
  border-radius: 38px;
}

.db-stage[data-device="tablet"] .db-bezel {
  padding: 12px;
  border-radius: 22px;
}

#frame,
#db-overlay-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  transition: width 0.4s ease, height 0.4s ease;
}

/* -------------------------------------------------------------------------- */
/* Device overlay (embedded mode) — dark, above the page                      */
/* -------------------------------------------------------------------------- */

.db-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  overflow: auto;
  padding: 20px;
  background: rgba(4, 6, 9, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color-scheme: dark;
}

.db-overlay[hidden] {
  display: none;
}

.db-overlay .db-overlay-scrim {
  position: absolute;
  inset: 0;
}

.db-overlay[data-device="phone"] .db-bezel,
.db-overlay[data-device="tablet"] .db-bezel {
  position: relative;
  width: fit-content;
  height: fit-content;
  flex: none;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  background: #101318;
  border: 1px solid #2a303b;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
}

.db-overlay[data-device="phone"] .db-bezel {
  padding: 10px;
  border-radius: 38px;
}

.db-overlay[data-device="tablet"] .db-bezel {
  padding: 12px;
  border-radius: 22px;
}

.db-overlay-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #262b34;
  background: #14171d;
  color: #e8eaef;
  font: 600 13.5px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.db-overlay-close:hover {
  background: #1b1f27;
}

/* -------------------------------------------------------------------------- */
/* Restore button (outside the bar, hard-coded dark)                           */
/* -------------------------------------------------------------------------- */

.db-restore {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10001;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #262b34;
  border-radius: 999px;
  background: #14171d;
  color: #e8eaef;
  font: 600 13.5px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.db-restore:hover {
  background: #1b1f27;
}

.db-restore[hidden] {
  display: none;
}

.db-restore svg {
  display: block;
  flex: none;
}

body.admin-bar .db-restore {
  top: 44px;
}

/* -------------------------------------------------------------------------- */
/* Small screens                                                               */
/* -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .db-demo-btn .db-name,
  .db-btn .db-btn-label {
    display: none;
  }

  #db-rotate,
  #db-refresh,
  #db-fullscreen {
    display: none;
  }

  .db-buy {
    padding: 0 12px;
  }

  .db-dev-cols,
  .db-demo-grid {
    grid-template-columns: 1fr;
  }

  .db-pop-devices,
  .db-pop-demos {
    left: 8px;
    right: 8px;
    width: auto;
  }
}