/**
 * Aktim - Form Popover Styles
 * Desktop: floating card with arrow above trigger button
 * Mobile (<768px): centered floating card
 *
 * @package    Aktim
 * @author     Mustafa Erdinc <mustafaerdinc@me.com>
 * @copyright  2024-2026 Bilgicler Yapi
 * @link       https://mustafaerdinc.com.tr
 */

/* ============================================
   BACKDROP (dimming overlay)
   ============================================ */
.form-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9996;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.form-popover-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   POPOVER CONTAINER
   ============================================ */
.form-popover {
  position: fixed;
  z-index: 9997;
  width: 380px;
  opacity: 0;
  pointer-events: none;
}

.form-popover.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   CONNECTOR ARROW (tooltip triangle)
   Points from popover card toward trigger button
   ============================================ */
.form-popover__arrow {
  position: absolute;
  z-index: 1;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
}

/* Default (above button): arrow points down ▼ */
.form-popover:not(.is-flipped):not(.is-side) .form-popover__arrow {
  bottom: -14px;
  border-width: 14px 14px 0 14px;
  border-top-color: rgba(45, 45, 45, 0.97);
}

/* Flipped (below button): arrow points up ▲ */
.form-popover.is-flipped .form-popover__arrow {
  top: -14px;
  border-width: 0 14px 14px 14px;
  border-bottom-color: rgba(45, 45, 45, 0.97);
}

/* Side: arrow points left ◀ */
.form-popover.is-side .form-popover__arrow {
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 14px 14px 14px 0;
  border-right-color: rgba(45, 45, 45, 0.97);
}

/* ============================================
   INNER CARD
   ============================================ */
.form-popover__card {
  position: relative;
  background: rgba(45, 45, 45, 0.97);
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ============================================
   TRIGGER BUTTON — elevated above backdrop
   ============================================ */
.btn.is-popover-active {
  z-index: 9997;
  position: relative;
}


/* ============================================
   BODY
   ============================================ */
.form-popover__body {
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Custom scrollbar */
.form-popover__body::-webkit-scrollbar {
  width: 4px;
}

.form-popover__body::-webkit-scrollbar-track {
  background: transparent;
}

.form-popover__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* ============================================
   CRM EMBED: Link color override
   ============================================ */
.form-popover__body a {
  color: #c9a662 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.form-popover__body a:hover,
.form-popover__body a:active {
  color: #dbb976 !important;
}

/* ============================================
   CRM EMBED: Flag rendering fix
   ============================================ */
.form-popover__body img[class*="flag"],
.form-popover__body .flag,
.form-popover__body [class*="country"] img,
.form-popover__body .iti__flag {
  border-radius: 2px !important;
  box-shadow: none !important;
  background: none !important;
  filter: none !important;
}

/* ============================================
   SCROLL LOCK
   ============================================ */
body.form-popover-open {
  overflow: hidden;
}

/* ============================================
   MOBILE: FLOATING TOOLTIP (< 768px)
   Same as desktop — positioned near trigger button
   ============================================ */
@media (max-width: 767px) {
  .form-popover {
    width: calc(100% - 24px);
    max-width: 380px;
  }

  .form-popover__card {
    max-height: 80vh;
  }

  .form-popover__body {
    max-height: calc(80vh - 50px);
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .form-popover-backdrop,
  .form-popover,
  .form-popover__card {
    transition: none;
  }
}
