/**
 * Isolated quote entry and lazy dialog.
 * Keeps the existing data attributes and jamt-site.js open/close/focus behaviour.
 * Includes the former v1.6 mobile sheet and desktop side-panel refinements.
 */

.jamt-quote-trigger,
.jamt-quote-dialog,
.jamt-quote-dialog *,
.jamt-quote-dialog *::before,
.jamt-quote-dialog *::after {
  box-sizing: border-box;
}

.jamt-quote-trigger {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 9997;
  display: inline-flex;
  min-width: 118px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--jamt-paper, #fff);
  border-radius: 12px;
  padding: 13px 18px;
  background: var(--jamt-signal, #315efb);
  box-shadow: 0 0 0 1px rgb(17 16 14 / 16%), 0 12px 30px rgb(17 16 14 / 22%);
  color: var(--jamt-on-dark, #fff);
  font: 700 14px/1.3 var(--jamt-font, Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif);
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.jamt-quote-trigger:hover {
  border-color: var(--jamt-paper, #fff);
  background: var(--jamt-signal-dark, #173fbd);
  color: var(--jamt-on-dark, #fff);
  box-shadow: 0 0 0 1px rgb(17 16 14 / 20%), 0 16px 34px rgb(17 16 14 / 26%);
  text-decoration: none !important;
}

.jamt-quote-trigger:active,
.jamt-quote-trigger:visited {
  color: var(--jamt-on-dark, #fff);
  text-decoration: none !important;
}

.jamt-quote-trigger:focus-visible {
  outline: 3px solid var(--jamt-signal-dark, #173fbd);
  outline-offset: 4px;
}

.jamt-quote-dialog__close:focus-visible {
  outline: 3px solid var(--jamt-signal, #315efb);
  outline-offset: 3px;
}

.jamt-quote-dialog {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  background: rgb(17 16 14 / 66%);
  color: var(--jamt-ink, #11100e);
  font-family: var(--jamt-font, Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif);
  backdrop-filter: none;
}

.jamt-quote-dialog[hidden] {
  display: none;
}

.jamt-quote-dialog__panel {
  display: grid;
  width: 100%;
  height: min(94vh, 900px);
  height: min(94dvh, 900px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 26%);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--jamt-canvas, #f7f7f2);
  box-shadow: 0 -22px 70px rgb(17 16 14 / 30%);
}

.jamt-quote-dialog__header {
  z-index: 2;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--jamt-line, #b9bbb4);
  padding: 12px 18px;
  background: var(--jamt-paper, #fff);
}

.jamt-quote-dialog__header p,
.jamt-quote-dialog__header h2 {
  margin: 0;
  font-family: inherit;
}

.jamt-quote-dialog__header p {
  color: var(--jamt-signal-dark, #173fbd);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.jamt-quote-dialog__header h2 {
  margin-top: 3px;
  color: var(--jamt-ink, #11100e);
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.jamt-quote-dialog__close {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--jamt-line, #b9bbb4);
  border-radius: 12px;
  padding: 0 0 3px;
  background: var(--jamt-paper, #fff);
  color: var(--jamt-ink, #11100e);
  font: inherit;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.jamt-quote-dialog__close:hover {
  border-color: var(--jamt-ink, #11100e);
  background: var(--jamt-ink, #11100e);
  color: var(--jamt-on-dark, #fff);
}

.jamt-quote-dialog__body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.jamt-quote-dialog__loading {
  margin: 16px;
  color: var(--jamt-muted, #484b46);
  font-size: 16px;
  line-height: 1.625;
}

.jamt-quote-dialog__loading a {
  color: var(--jamt-signal-dark, #173fbd);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.jamt-quote-dialog .jamt-guide {
  max-width: none;
  margin: 0;
}

body.jamt-quote-open {
  overflow: hidden;
}

.jamt-has-quote-bubble :where(#ast-scroll-top, .ast-scroll-top-icon) {
  bottom: 84px;
}

.jamt-has-quote-bubble.jamt-recaptcha-active .jamt-quote-trigger {
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 92px));
}

.jamt-has-quote-bubble.jamt-recaptcha-active :where(#ast-scroll-top, .ast-scroll-top-icon) {
  bottom: 154px;
}

.jamt-has-quote-bubble .grecaptcha-badge {
  z-index: 10000;
}

@media (min-width: 620px) {
  .jamt-quote-dialog__panel {
    width: min(760px, calc(100% - 32px));
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    margin: 16px 0 16px 16px;
    border: 1px solid rgb(255 255 255 / 25%);
    border-right: 0;
    border-radius: 24px 0 0 24px;
  }

  .jamt-quote-dialog__body {
    padding: 18px;
  }
}

@media (max-width: 680px) {
  .jamt-quote-trigger {
    min-width: 104px;
    min-height: 48px;
    padding: 11px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jamt-quote-trigger,
  .jamt-quote-dialog__close {
    scroll-behavior: auto;
    transition: none;
  }
}
