/*==============================================================================
  ENQUIRY WIDGET -- floating "Talk to statSCALAR" button + popup panel.
  Loaded globally (front.footer include on every page). Field styling
  (.form-control, .select-group arrow, .demo-submit) is intentionally NOT
  redefined here -- it's inherited from request-demo-blade.css's .demo-form
  rules, already loaded site-wide, so widget inputs match the rest of the
  site automatically.
==============================================================================*/

.ss-enquiry-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1050;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

/* ---------- Closed state: compact floating button ---------- */
.ss-enquiry-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px 0 15px;
  border: none;
  border-radius: 999px;
  background: var(--ss-primary);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--ss-shadow-lg);
  transition: var(--ss-transition);
}

.ss-enquiry-toggle:hover,
.ss-enquiry-toggle:focus-visible {
  background: var(--ss-primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 26px 55px rgba(0, 168, 107, 0.32);
}

.ss-enquiry-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ss-enquiry-toggle-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.ss-enquiry-toggle-icon svg {
  width: 18px;
  height: 18px;
}

.ss-enquiry-toggle-label {
  white-space: nowrap;
}

/* Widget open: keep the launcher visible but visually "pressed" */
.ss-enquiry-widget.open .ss-enquiry-toggle {
  background: var(--ss-primary-dark);
}

/* ---------- Popup panel ---------- */
.ss-enquiry-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 328px;
  max-width: calc(100vw - 32px);
  max-height: min(500px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--ss-white);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-lg);
  box-shadow: var(--ss-shadow-lg);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
}

.ss-enquiry-widget.open .ss-enquiry-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  animation: ssEnquiryPanelIn 0.25s ease;
}

@keyframes ssEnquiryPanelIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ss-enquiry-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, var(--ss-primary), var(--ss-primary-dark));
  color: #fff;
  flex-shrink: 0;
}

.ss-enquiry-panel-header-text h2 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
}

.ss-enquiry-panel-header-text p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
}

.ss-enquiry-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ss-enquiry-close:hover,
.ss-enquiry-close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
}

.ss-enquiry-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ss-enquiry-close svg {
  width: 13px;
  height: 13px;
}

.ss-enquiry-panel-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
}

/* ---------- Quick enquiry options ----------
   Fixed 3-column grid (rather than flex-wrap, whose row count shifts with
   label length) so the 5 options always land on exactly 2 lines. */
.ss-enquiry-quick-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.ss-enquiry-quick-btn {
  padding: 5px 6px;
  border: 1px solid var(--ss-border);
  border-radius: 10px;
  background: var(--ss-bg);
  color: var(--ss-text);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  transition: 0.2s ease;
}

.ss-enquiry-quick-btn:hover {
  border-color: var(--ss-primary);
  color: var(--ss-primary);
}

.ss-enquiry-quick-btn:focus-visible {
  outline: 2px solid var(--ss-primary);
  outline-offset: 2px;
}

.ss-enquiry-quick-btn.active {
  background: var(--ss-primary);
  border-color: var(--ss-primary);
  color: #fff;
}

/* ---------- Form layout ----------
   Overrides the site-wide .demo-form field sizing (46px min-height,
   10px/16px padding, 14px font, 24px group spacing) with tighter values --
   this panel is a small popover, not a full-page form, so it needs a
   denser rhythm than the /request-a-demo page uses. */
.ss-enquiry-form.ss-enquiry-form {
  /* .demo-form itself carries 34px 40px padding, sized for the full-page
     /request-a-demo layout -- far too roomy for this compact popover. */
  padding: 14px 5px;
}

.ss-enquiry-form.ss-enquiry-form .ss-form-group {
  margin-bottom: 10px;
}

.ss-enquiry-form.ss-enquiry-form .form-control {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.ss-enquiry-form.ss-enquiry-form textarea.form-control {
  height: 56px;
  min-height: 56px;
  padding: 8px 12px;
}

.ss-enquiry-form.ss-enquiry-form .select-group select.form-control {
  padding-right: 40px;
}

.ss-enquiry-form.ss-enquiry-form .select-group::after {
  right: 14px;
  width: 6px;
  height: 6px;
}

.ss-enquiry-form .ss-enquiry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ss-enquiry-form label {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ss-heading);
}

.ss-enquiry-required {
  color: var(--ss-accent-dark);
}

.ss-enquiry-error {
  display: none;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #dc2626;
}

.ss-enquiry-form .ss-form-group.has-error .form-control {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.ss-enquiry-form .ss-form-group.has-error .ss-enquiry-error {
  display: block;
}

.ss-enquiry-alert {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.ss-enquiry-alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.ss-enquiry-form.ss-enquiry-form .ss-enquiry-submit {
  min-height: 40px;
  height: 40px;
  margin-top: 2px;
  border-radius: 10px;
  font-size: 13.5px;
}

.ss-enquiry-submit {
  position: relative;
}

.ss-enquiry-widget .ss-enquiry-submit.is-loading .ss-enquiry-submit-label {
  visibility: hidden;
}

.ss-enquiry-submit.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ssEnquirySpin 0.7s linear infinite;
}

@keyframes ssEnquirySpin {
  to { transform: rotate(360deg); }
}

.ss-enquiry-form.ss-enquiry-form .ss-enquiry-privacy {
  /* beats the site-wide ".demo-form p" rule (14px), which otherwise wins
     on specificity since it also matches this <p>. */
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ss-muted);
  text-align: center;
}

.ss-enquiry-privacy a {
  color: var(--ss-primary);
  font-weight: 600;
}

.ss-enquiry-privacy a:hover {
  text-decoration: underline;
}

/* ---------- Success state ---------- */
.ss-enquiry-success {
  text-align: center;
  padding: 6px 4px 2px;
}

.ss-enquiry-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--ss-primary-light);
  color: var(--ss-primary);
}

.ss-enquiry-success-icon svg {
  width: 20px;
  height: 20px;
}

.ss-enquiry-success h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ss-heading);
}

.ss-enquiry-success p {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--ss-text);
  line-height: 1.5;
}

.ss-enquiry-success .ss-btn {
  width: 100%;
  min-height: 38px;
  height: 38px;
  font-size: 12.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .ss-enquiry-widget {
    right: 16px;
    bottom: 16px;
  }

  .ss-enquiry-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .ss-enquiry-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .ss-enquiry-panel {
    right: -16px;
    width: 100vw;
    max-width: calc(100vw - 24px);
    max-height: min(460px, calc(100vh - 140px));
  }
}

@media (max-width: 360px) {
  .ss-enquiry-form .ss-enquiry-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-enquiry-toggle,
  .ss-enquiry-panel,
  .ss-enquiry-quick-btn,
  .ss-enquiry-close {
    transition: none;
  }

  .ss-enquiry-widget.open .ss-enquiry-panel {
    animation: none;
  }

  .ss-enquiry-toggle:hover {
    transform: none;
  }
}

/* ---------- Back-to-top stacking (front pages only) ----------
   scroll-to-top.css defaults that button to the standard single-widget
   bottom-right spot; raise it here so it stacks above this widget's
   closed-state toggle instead of overlapping it. Qualified with `body` so
   this wins on specificity regardless of the two stylesheets' <link>
   order, rather than depending on load sequence. */
body .ss-back-to-top {
  bottom: 82px;
}

@media (max-width: 480px) {
  body .ss-back-to-top {
    bottom: 74px;
  }
}
