/* ==========================================================================
   Detailerz — "View" demo popup (index.html). The real app runs inside the
   phone frame (an iframe of demo.crmdetailerz.com). Built by demo.js.
   All classes are prefixed dm- so nothing collides with the site's styles.
   ========================================================================== */

.dm { position: fixed; inset: 0; z-index: 1000; display: none; }
.dm.is-open { display: block; }
.dm__scrim {
  position: absolute; inset: 0;
  background: rgba(2, 4, 8, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dm__stage {
  position: relative; height: 100%;
  display: flex; align-items: center; justify-content: center; gap: 44px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

.dm__aside { max-width: 310px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.dm__aside h3 { color: var(--text); font-size: 22px; line-height: 1.25; margin-bottom: 10px; letter-spacing: -0.01em; }
.dm__aside ul { list-style: none; display: grid; gap: 8px; margin: 14px 0 22px; }
.dm__aside li { display: flex; gap: 8px; align-items: flex-start; }
.dm__aside li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); margin-top: 8px; }
.dm__aside-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.dm__full { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; text-decoration: none; }
.dm__full:hover { color: var(--text); }

.dm__close {
  position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 10; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: var(--text);
  border: 1px solid var(--line-2);
}
.dm__close:hover { background: rgba(255, 255, 255, 0.14); }

.dm__phone {
  position: relative; flex: none;
  width: 400px; height: min(820px, calc(100dvh - 48px));
  border-radius: 46px; padding: 12px;
  background: linear-gradient(160deg, #2a323d, #12171e);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 40px 120px -20px rgba(0,0,0,0.8), var(--glow);
}
.dm__screen { position: relative; height: 100%; overflow: hidden; border-radius: 36px; background: #04060a; }
.dm__island {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 104px; height: 28px; border-radius: 20px; background: #000; z-index: 3; pointer-events: none;
}
.dm__frame { display: block; width: 100%; height: 100%; border: 0; background: #04060a; padding-top: 40px; box-sizing: border-box; }
.dm__loader {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: #04060a; color: #94a3b1; font-size: 14px; transition: opacity 0.3s;
}
.dm__loader.is-hidden { opacity: 0; pointer-events: none; }
.dm__spin {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--cyan);
  animation: dm-spin 0.8s linear infinite;
}
@keyframes dm-spin { to { transform: rotate(360deg); } }

/* phones: the demo IS the screen */
@media (max-width: 760px) {
  .dm__aside { display: none; }
  .dm__stage { padding: 0; }
  .dm__phone { width: 100%; height: 100%; border-radius: 0; padding: 0; box-shadow: none; background: #04060a; }
  .dm__screen { border-radius: 0; }
  .dm__island { display: none; }
  .dm__frame { padding-top: env(safe-area-inset-top, 0px); }
  .dm__close { top: calc(env(safe-area-inset-top, 0px) + 8px); right: 10px; width: 34px; height: 34px; background: rgba(4,6,10,0.75); }
}

.dm :focus-visible { outline: 2px solid #22e3d0; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .dm__spin { animation-duration: 2s; } .dm__loader { transition: none; } }
html.dm-lock, html.dm-lock body { overflow: hidden; }

/* ---- Mobile / Computer switch (computers only) ---- */
.dm__toggle {
  display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 16px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2);
}
.dm__toggle button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 0; border-radius: 999px; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 13.5px;
}
.dm__toggle button:hover { color: var(--text); }
.dm__toggle button[aria-pressed="true"] { background: var(--cyan); color: #04131a; font-weight: 600; }
.dm__bar { display: none; }

@media (min-width: 761px) {
  .dm.is-desktop .dm__stage { gap: 32px; }
  .dm.is-desktop .dm__aside { max-width: 250px; }
  .dm.is-desktop .dm__phone {
    width: min(1120px, calc(100vw - 330px)); height: min(740px, calc(100dvh - 64px));
    border-radius: 14px; padding: 0; background: #0d1117;
    display: flex; flex-direction: column;
  }
  .dm.is-desktop .dm__bar {
    display: flex; flex: none; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  .dm.is-desktop .dm__bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a434e; }
  .dm.is-desktop .dm__bar i:nth-child(1) { background: #ff5f57; }
  .dm.is-desktop .dm__bar i:nth-child(2) { background: #febc2e; }
  .dm.is-desktop .dm__bar i:nth-child(3) { background: #28c840; }
  .dm.is-desktop .dm__url {
    display: flex; align-items: center; margin-left: 14px; padding: 0 12px; height: 22px;
    flex: 1; max-width: 360px; border-radius: 6px; background: rgba(255, 255, 255, 0.06);
    color: #8b98a5; font-size: 12px;
  }
  .dm.is-desktop .dm__screen { flex: 1; height: auto; min-height: 0; border-radius: 0 0 14px 14px; }
  .dm.is-desktop .dm__island { display: none; }
  .dm.is-desktop .dm__frame { padding-top: 0; transform-origin: 0 0; }
}
@media (max-width: 760px) { .dm__toggle { display: none; } }

/* phones: no bar of our own. The close X sits inside the app's demo bar,
   just right of its Start free trial button (that bar is 44px tall and
   leaves 54px free on the right for it), so the two read as one bar. */
@media (max-width: 760px) {
  .dm__frame { padding-top: env(safe-area-inset-top, 0px); }
  .dm__close { top: calc(env(safe-area-inset-top, 0px) + 6px); right: 12px; width: 32px; height: 32px; }
}

/* left side is just the "Demo View" label + the Mobile/Computer switch */
.dm__aside h3 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.dm__aside .dm__plan { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.dm__aside .dm__toggle { margin: 0; }
.dm__aside { display: flex; flex-direction: column; align-items: center; text-align: center; }
@media (max-width: 760px) { .dm__aside { display: none; } }

/* Mobile view (phone frame on computers, full screen on phones): one row at
   the top of the app — "Detailerz live demo" on the left, the app's own
   Start free trial button (its 44px demo bar right-aligns it, leaving 54px
   free on the right), then this close X. The stage's X is Computer view only. */
.dm__label {
  position: absolute; z-index: 4; top: 40px; left: 16px; height: 44px;
  display: flex; align-items: center; white-space: nowrap; pointer-events: none;
  color: #e6edf3; font-size: 13.5px; font-weight: 600;
}
.dm__close--bar { top: 46px; right: 11px; z-index: 4; width: 32px; height: 32px; background: rgba(4, 6, 10, 0.55); }
.dm__stage > .dm__close { display: none; }
.dm.is-desktop .dm__stage > .dm__close { display: grid; }
.dm.is-desktop .dm__label, .dm.is-desktop .dm__close--bar { display: none; }
@media (max-width: 760px) {
  .dm__label { top: env(safe-area-inset-top, 0px); }
  .dm__close--bar { top: calc(env(safe-area-inset-top, 0px) + 6px); right: 12px; }
}
@media (max-width: 340px) { .dm__label { left: 12px; font-size: 12px; } }
