/* Course floating actions — always physical RIGHT with edge padding */

html body .course-fab-stack,
body .course-fab-stack,
.course-fab-stack {
  --course-fab-size: 3.75rem;
  --course-fab-gap: 0.85rem;
  --course-fab-edge: 1.5rem;

  position: fixed !important;
  z-index: 9998 !important;
  top: auto !important;
  /* Physical right only — do NOT set inset-inline-* (it overrides right in LTR) */
  right: calc(var(--course-fab-edge) + env(safe-area-inset-right, 0px)) !important;
  left: auto !important;
  bottom: calc(var(--course-fab-edge) + env(safe-area-inset-bottom, 0px)) !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  display: flex !important;
  /* DOM order: + menu first, WhatsApp second → + on top, WA below */
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: var(--course-fab-gap);
  pointer-events: none;
  animation: courseFabStackIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.course-fab-stack > * {
  pointer-events: auto;
}

.course-fab-stack__whatsapp,
.course-fab-menu__toggle {
  width: var(--course-fab-size);
  height: var(--course-fab-size);
  border-radius: 50%;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(15, 39, 68, 0.2);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, filter 0.2s ease;
}

.course-fab-stack__whatsapp {
  position: relative;
  z-index: 1;
  background: #25d366 !important;
  color: #fff !important;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
}

.course-fab-stack__whatsapp:hover {
  transform: scale(1.08);
  color: #fff !important;
  background: #1ebe57 !important;
}

.course-fab-menu {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.course-fab-menu__toggle {
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, #337ab7 0%, #286090 100%) !important;
  color: #fff !important;
  box-shadow:
    0 12px 28px rgba(51, 122, 183, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.course-fab-stack__whatsapp svg,
.course-fab-stack__whatsapp [data-lucide],
.course-fab-menu__toggle svg,
.course-fab-menu__toggle [data-lucide],
.course-fab-menu__item-icon svg,
.course-fab-menu__item-icon [data-lucide] {
  width: 1.45rem;
  height: 1.45rem;
  stroke-width: 2.25;
}

.course-fab-menu__toggle:hover {
  transform: scale(1.08);
  filter: brightness(1.05);
  color: #fff;
}

.course-fab-menu.is-open .course-fab-menu__toggle {
  background: #0f2744;
  transform: rotate(45deg);
}

.course-fab-menu__toggle-icon {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.course-fab-menu__toggle-icon--close {
  opacity: 0;
  transform: scale(0.6) rotate(-45deg);
}

.course-fab-menu.is-open .course-fab-menu__toggle-icon--plus {
  opacity: 0;
  transform: scale(0.6);
}

.course-fab-menu.is-open .course-fab-menu__toggle-icon--close {
  opacity: 1;
  transform: scale(1) rotate(-45deg);
}

.course-fab-menu__options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  min-width: 12.5rem;
}

.course-fab-menu__options[hidden] {
  display: none !important;
}

.course-fab-menu.is-open .course-fab-menu__options {
  display: flex !important;
}

.course-fab-menu__form {
  margin: 0;
  width: 100%;
}

.course-fab-menu__item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0f2744;
  font-family: var(--font-sans, "Archivo", "GE SS Two", system-ui, sans-serif);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  text-align: start;
  white-space: nowrap;
  box-shadow:
    0 8px 22px rgba(15, 39, 68, 0.12),
    0 0 0 1px rgba(51, 122, 183, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: courseFabItemIn 0.28s ease both;
}

.course-fab-menu.is-open .course-fab-menu__item:nth-child(1) { animation-delay: 0.02s; }
.course-fab-menu.is-open .course-fab-menu__item:nth-child(2) { animation-delay: 0.06s; }
.course-fab-menu.is-open .course-fab-menu__item:nth-child(3) { animation-delay: 0.1s; }

.course-fab-menu__item:hover {
  transform: translateX(-3px);
  color: #0f2744;
  box-shadow:
    0 12px 28px rgba(15, 39, 68, 0.16),
    0 0 0 1px rgba(51, 122, 183, 0.18);
}

[dir="rtl"] .course-fab-menu__item:hover {
  transform: translateX(3px);
}

.course-fab-menu__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
}

.course-fab-menu__item--checkout .course-fab-menu__item-icon {
  background: linear-gradient(135deg, #337ab7, #286090);
}

.course-fab-menu__item--contact .course-fab-menu__item-icon {
  background: #0f2744;
}

.course-fab-menu__item--instapay .course-fab-menu__item-icon {
  background: linear-gradient(135deg, #5b2cff, #7c3aed);
}

@keyframes courseFabStackIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Hide legacy enroll pill if any leftover markup exists */
.course-floating-enroll {
  display: none !important;
}

/* ----- Mobile sticky bottom bar ----- */
.course-enroll-sticky {
  display: none;
}

@media (max-width: 991px) {
  /* Keep WhatsApp + menu FAB above the bottom enroll bar.
     Match base selector specificity so this bottom wins. */
  html body .course-fab-stack,
  body .course-fab-stack,
  .course-fab-stack {
    --course-fab-size: 3.4rem;
    --course-fab-edge: 1.25rem;
    --course-enroll-bar-h: 4.75rem;
    bottom: calc(
      var(--course-enroll-bar-h)
      + 0.85rem
      + env(safe-area-inset-bottom, 0px)
    ) !important;
  }

  .course-fab-menu__options {
    min-width: 11.5rem;
  }

  .course-enroll-sticky {
    --course-enroll-bar-h: 4.75rem;
    display: block;
    position: fixed;
    top: auto !important;
    bottom: 0 !important;
    left: 0;
    right: 0;
    z-index: 9970;
    pointer-events: none;
    animation: courseEnrollStickyIn 0.35s ease both;
  }

  .course-enroll-sticky__inner {
    pointer-events: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: var(--course-enroll-bar-h);
    padding: 0.55rem 0.9rem;
    padding-left: max(0.9rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.9rem, env(safe-area-inset-right, 0px));
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.97) 100%);
    border-top: 1px solid rgba(51, 122, 183, 0.14);
    border-bottom: 0;
    box-shadow: 0 -8px 22px rgba(15, 39, 68, 0.1);
    backdrop-filter: blur(10px);
  }

  .course-enroll-sticky__price {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    margin-right: auto;
  }

  .course-enroll-sticky__form,
  .course-enroll-sticky__btn {
    order: 2;
    flex-shrink: 0;
  }

  .course-enroll-sticky__form {
    margin: 0;
  }

  .course-enroll-sticky__price-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
  }

  .course-enroll-sticky__price-value {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f2744;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .course-enroll-sticky__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.55rem;
    padding: 0.55rem 1.15rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary, #337ab7) 0%, var(--color-primary-hover, #286090) 100%);
    color: #fff;
    font-family: var(--font-sans, "Archivo", "GE SS Two", system-ui, sans-serif);
    font-size: 0.84rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(51, 122, 183, 0.28);
    cursor: pointer;
  }

  .course-enroll-sticky__btn:hover {
    color: #fff;
    filter: brightness(1.04);
  }

  body:has(.course-enroll-sticky) {
    --course-enroll-bar-h: 4.75rem;
    padding-top: var(--navbar-height, 64px) !important;
    padding-bottom: calc(var(--course-enroll-bar-h) + env(safe-area-inset-bottom, 0px) + 0.5rem) !important;
    scroll-padding-top: var(--navbar-height, 64px);
    scroll-padding-bottom: calc(var(--course-enroll-bar-h) + env(safe-area-inset-bottom, 0px));
  }

  @keyframes courseEnrollStickyIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (min-width: 992px) {
  .course-enroll-sticky {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .course-fab-stack,
  .course-fab-menu__item,
  .course-enroll-sticky {
    animation: none;
  }

  .course-fab-menu__toggle,
  .course-fab-stack__whatsapp,
  .course-fab-menu__item {
    transition: none;
  }
}