/* ==========================================================================
   Augmented Systems — Sticky "Free Consultation" CTA + dialog (site-wide)
   --------------------------------------------------------------------------
   Rendered once per page by <x-frontend.ui.consult-cta />, which is included
   from resources/views/frontend/includes/footer.blade.php — so these rules
   load on every frontend page.

   SIZING: every length is in px, not rem. The theme sets :root{font-size:20px},
   so rem-based paddings/radii would render ~25% larger than intended (same
   convention as the .as-hero2 block in home-revamp.css).

   Everything is scoped under .as-cta-tab / .as-consult, so no global theme
   rule is touched.
   ========================================================================== */
.as-cta-tab,
.as-consult {
  --cta-blue: #2f6fed;
  --cta-blue-dark: #1c4fd0;
  --cta-ink: #0f1b34;
  --cta-body: #5b6579;
  --cta-field: #f4f6f9;
}

/* ==========================================================================
   1. STICKY TAB — vertical pill anchored to the right edge of the viewport
   ========================================================================== */
.as-cta-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 1035;                 /* above the sticky navbar (1030), below the dialog */

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  margin: 0;
  padding: 20px 11px;
  border: 0;
  border-radius: 14px 0 0 14px;

  background: linear-gradient(180deg, var(--cta-blue) 0%, var(--cta-blue-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(28, 79, 208, 0.35);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: padding-right 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.as-cta-tab:hover,
.as-cta-tab:focus-visible {
  padding-right: 16px;           /* slides a touch out of the edge on hover */
  box-shadow: 0 14px 36px rgba(28, 79, 208, 0.45);
  color: #fff;
  filter: brightness(1.04);
}

.as-cta-tab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -5px;
}

.as-cta-tab .as-cta-tab-icon {
  flex: none;
  width: 18px;
  height: 18px;
  display: block;
}

.as-cta-tab .as-cta-tab-text {
  writing-mode: vertical-rl;     /* reads top-to-bottom down the tab */
  text-orientation: mixed;
  font-family: var(--font-display, inherit);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Hide the tab while the dialog it opens is on screen. */
body.as-consult-open .as-cta-tab {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   2. DIALOG
   ========================================================================== */
.as-consult {
  position: fixed;
  inset: 0;
  z-index: 1080;                 /* above Bootstrap modals (1055) */

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;

  background: rgba(15, 27, 52, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.as-consult.is-open {
  opacity: 1;
  visibility: visible;
}

/* Safety net for the no-JS case: the markup also carries the hidden attribute. */
.as-consult[hidden] {
  display: none;
}

.as-consult .as-consult-panel {
  position: relative;
  width: 100%;
  max-width: 510px;
  margin: auto;
  padding: 26px 26px 28px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 30px 70px rgba(15, 27, 52, 0.28);

  transform: translateY(14px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.as-consult.is-open .as-consult-panel {
  transform: none;
}

/* --- Header -------------------------------------------------------------- */
.as-consult .as-consult-title {
  margin: 0 34px 8px 0;          /* clears the close button */
  font-family: var(--font-display, inherit);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--cta-ink);
}

.as-consult .as-consult-sub {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--cta-body);
}

.as-consult .as-consult-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cta-body);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.as-consult .as-consult-close:hover,
.as-consult .as-consult-close:focus-visible {
  background: var(--cta-field);
  color: var(--cta-ink);
}

.as-consult .as-consult-close svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* --- Fields -------------------------------------------------------------- */
.as-consult .as-consult-field {
  position: relative;
  margin-bottom: 12px;
}

.as-consult .as-consult-input {
  width: 100%;
  display: block;
  padding: 14px 44px 14px 16px;  /* right padding leaves room for the field icon */
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--cta-field);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--cta-ink);
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.as-consult .as-consult-input::placeholder {
  color: #98a1b0;
  opacity: 1;
}

.as-consult .as-consult-input:focus {
  outline: 0;
  background: #fff;
  border-color: var(--cta-blue);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.14);
}

.as-consult textarea.as-consult-input {
  min-height: 108px;
  padding-right: 16px;
  resize: vertical;
}

/* Small muted glyph parked inside a field (email / phone). */
.as-consult .as-consult-field-icon {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: #a8b1c0;
  pointer-events: none;
}

/* --- Submit -------------------------------------------------------------- */
.as-consult .as-consult-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 24px;
  border: 0;
  border-radius: 10px;
  background: var(--cta-blue);
  color: #fff;
  font-family: var(--font-display, inherit);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.as-consult .as-consult-submit:hover,
.as-consult .as-consult-submit:focus-visible {
  background: var(--cta-blue-dark);
  color: #fff;
  box-shadow: 0 10px 24px rgba(28, 79, 208, 0.3);
  transform: translateY(-1px);
}

.as-consult .as-consult-submit svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.as-consult .as-consult-submit:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.as-consult .as-consult-input.is-invalid {
  box-shadow: inset 0 0 0 1.5px #d64545;
}

.as-consult .as-consult-alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}

.as-consult .as-consult-alert--success {
  background: #e8f6ee;
  color: #1b6b3a;
}

.as-consult .as-consult-alert--error {
  background: #fdeeee;
  color: #a12626;
}

/* Honeypot — visually and for AT hidden; bots that fill it are rejected. */
.as-consult .as-consult-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   3. RESPONSIVE
   ========================================================================== */

/* Tablets — trim the tab so it eats less of a narrower viewport. */
@media (max-width: 991.98px) {
  .as-cta-tab {
    padding: 16px 9px;
  }

  .as-cta-tab .as-cta-tab-text {
    font-size: 12px;
    letter-spacing: 0.1em;
  }
}

/* Phones — the vertical tab becomes a thumb-reachable pill at bottom right. */
@media (max-width: 575.98px) {
  .as-cta-tab {
    top: auto;
    bottom: 18px;
    right: 14px;
    transform: none;

    flex-direction: row;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
  }

  .as-cta-tab:hover,
  .as-cta-tab:focus-visible {
    padding-right: 18px;
  }

  .as-cta-tab .as-cta-tab-text {
    writing-mode: horizontal-tb;
    font-size: 12.5px;
  }

  .as-consult {
    padding: 16px 12px;
    align-items: flex-end;        /* sheet-style: rises from the bottom */
  }

  .as-consult .as-consult-panel {
    padding: 22px 18px 24px;
    border-radius: 16px;
  }

  .as-consult .as-consult-title {
    font-size: 19px;
  }

  .as-consult .as-consult-sub {
    font-size: 13.5px;
    margin-bottom: 16px;
  }

  .as-consult .as-consult-submit {
    width: 100%;
    justify-content: center;
  }
}

/* Short viewports (landscape phones): keep the panel scrollable, not clipped. */
@media (max-height: 560px) {
  .as-consult {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .as-cta-tab,
  .as-consult,
  .as-consult .as-consult-panel,
  .as-consult .as-consult-submit {
    transition: none;
  }

  .as-consult .as-consult-panel {
    transform: none;
  }
}
