/* R-Code "Build" widget — draggable launcher + off-canvas bottom sheet (phones) / pop-up (larger screens). All rules scoped to .bw */

.bw { --bw-accent: #FF6550; --bw-primary: #4D44C5; --bw-ink: #14122B; --bw-muted: #6B7280; --bw-line: #ECEBF3; font-family: var(--ztc-family-font1, system-ui, sans-serif); }
.bw *, .bw *::before, .bw *::after { box-sizing: border-box; }
html.bw-lock { overflow: hidden; }

/* Launcher — position is set by js/float.js (right/bottom) so it can be dragged anywhere */
.bw-launch {
  position: fixed; z-index: 9989;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1; color: #fff;
  background: var(--bw-accent); border: 0; border-radius: 999px; cursor: grab;
  box-shadow: 0 10px 24px -8px rgba(255, 101, 80, .65);
  transition: background-color .2s ease, box-shadow .2s ease;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.bw-launch:hover { background: #F04E38; }
.bw-launch.is-dragging { cursor: grabbing; box-shadow: 0 18px 34px -10px rgba(255, 101, 80, .75); transform: scale(1.06); transition: none; }
.bw-launch:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--bw-accent); }
.bw-launch__icon { display: inline-flex; }
.bw.is-open .bw-launch { visibility: hidden; }
@media (max-width: 575px) {
  .bw-launch { padding: 14px; }
  .bw-launch__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* Backdrop */
.bw-scrim { position: fixed; inset: 0; z-index: 2000000000; background: rgba(20, 18, 43, .5); opacity: 0; transition: opacity .25s ease; }
.bw-scrim[hidden], .bw-sheet[hidden] { display: none; }
.bw.is-open .bw-scrim { opacity: 1; }

/* Sheet — phones: slides up from the bottom, about 80% of the screen */
.bw-sheet {
  position: fixed; z-index: 2000000001; left: 0; right: 0; bottom: 0;   /* above the site header and preloader */
  display: flex; flex-direction: column;
  height: 80vh; height: 80dvh; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  background: #fff; border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px -20px rgba(20, 18, 43, .5);
  transform: translateY(105%); transition: transform .28s cubic-bezier(.22, .8, .25, 1);
  overflow: hidden;
}
.bw.is-open .bw-sheet { transform: none; }

.bw-grab { flex: 0 0 auto; display: flex; justify-content: center; padding: 10px 0 2px; cursor: grab; touch-action: none; }
.bw-grab span { width: 44px; height: 5px; background: #D5D3E6; border-radius: 99px; }
.bw-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px 12px 20px; border-bottom: 1px solid var(--bw-line); touch-action: none; }
.bw-head h2 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.25; color: var(--bw-ink); }
.bw-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--bw-muted); }
.bw-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; color: var(--bw-ink); background: #F4F3FA; border: 0; border-radius: 50%; cursor: pointer; }
.bw-close:hover { background: #E8E6F5; }
.bw-close:focus-visible { outline: 2px solid var(--bw-primary); outline-offset: 2px; }

.bw-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 28px; background: #fff; -webkit-overflow-scrolling: touch; }
.bw-body:focus { outline: none; }

/* The builder inside the sheet: no card chrome of its own */
.bw .pb-card { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.bw .pb-progress { margin-bottom: 20px; }

/* Loading / error */
.bw-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 12px; text-align: center; color: var(--bw-muted); }
.bw-state p { margin: 0; }
.bw-spinner { width: 34px; height: 34px; border: 3px solid #E4E2F6; border-top-color: var(--bw-primary); border-radius: 50%; animation: bw-spin .8s linear infinite; }
@keyframes bw-spin { to { transform: rotate(360deg); } }
.bw-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.bw-btn { display: inline-block; padding: 10px 18px; font: inherit; font-size: 14px; font-weight: 600; color: #fff; text-decoration: none; background: var(--bw-primary); border: 1.5px solid var(--bw-primary); border-radius: 10px; cursor: pointer; }
.bw-btn--ghost { color: var(--bw-primary); background: #fff; }

/* Phones: once the person types, the sheet grows to cover the whole screen */
@media (max-width: 767px) {
  .bw-sheet { transition: transform .28s cubic-bezier(.22, .8, .25, 1), height .26s ease, max-height .26s ease, border-radius .26s ease; }
  .bw.is-full .bw-sheet { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .bw.is-full .bw-grab { display: none; }
}

/* Larger screens: a centred pop-up */
@media (min-width: 768px) {
  .bw-sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(900px, calc(100vw - 48px)); height: auto; max-height: min(88vh, 880px);
    border-radius: 24px; box-shadow: 0 40px 100px -30px rgba(20, 18, 43, .6);
    transform: translate(-50%, -46%) scale(.96); opacity: 0;
    transition: transform .22s ease, opacity .22s ease;
  }
  .bw.is-open .bw-sheet { transform: translate(-50%, -50%); opacity: 1; }
  .bw-grab { display: none; }
  .bw-head { padding: 18px 16px 14px 28px; touch-action: auto; }
  .bw-body { padding: 24px 32px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .bw-sheet, .bw-scrim, .bw-launch { transition: none; }
  .bw-spinner { animation-duration: 2.4s; }
}
@media print { .bw { display: none !important; } }

/* No scrollbars in the Build widget either (it still scrolls by touch, wheel or keys). */
.bw-sheet, .bw-sheet *, .bw-body, .bw-body * { scrollbar-width: none; -ms-overflow-style: none; }
.bw-sheet *::-webkit-scrollbar, .bw-body *::-webkit-scrollbar { width: 0; height: 0; display: none; }
