/**
 * KFCI Floating Contact Widget
 * Structural + animation styles. Colors, sizes, spacing and typography
 * are all controlled dynamically via Elementor Style controls (CSS vars
 * and generated selectors) — this file only holds layout + keyframes.
 */

.kfci-floating-contact {
  --kfci-fc-offset-x: 24px;
  --kfci-fc-offset-y: 24px;
  --kfci-fc-glow-color: rgba(228, 0, 43, 0.65);
  --kfci-fc-glow-spread: 18px;
  --kfci-fc-glow-speed: 2s;
  --kfci-fc-pulse-color: rgba(228, 0, 43, 0.55);
  --kfci-fc-entrance-delay: 0s;

  position: fixed !important;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
}

/* ---------- Position variants ---------- */
.kfci-fc-pos-bottom-right {
  right: var(--kfci-fc-offset-x);
  bottom: var(--kfci-fc-offset-y);
  flex-direction: column;
  align-items: flex-end;
}
.kfci-fc-pos-bottom-left {
  left: var(--kfci-fc-offset-x);
  bottom: var(--kfci-fc-offset-y);
  flex-direction: column;
  align-items: flex-start;
}
.kfci-fc-pos-top-right {
  right: var(--kfci-fc-offset-x);
  top: var(--kfci-fc-offset-y);
  flex-direction: column-reverse;
  align-items: flex-end;
}
.kfci-fc-pos-top-left {
  left: var(--kfci-fc-offset-x);
  top: var(--kfci-fc-offset-y);
  flex-direction: column-reverse;
  align-items: flex-start;
}
.kfci-fc-pos-middle-right {
  right: var(--kfci-fc-offset-x);
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: flex-end;
}
.kfci-fc-pos-middle-left {
  left: var(--kfci-fc-offset-x);
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: flex-start;
}

/* ---------- Trigger button ---------- */
.kfci-floating-contact__trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  background-color: #e4002b;
  color: #fff;
  border-radius: 100%;
  min-height: 60px;
  padding: 16px 20px;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
  line-height: 1;
  font-family: inherit;
}

.kfci-floating-contact__trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Ensure SVG icons inherit color properly */
  color: inherit;
}

/* FIX: Ensure Font Awesome SVG icons render correctly */
.kfci-floating-contact__trigger-icon svg,
.kfci-floating-contact__item-icon svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  overflow: visible;
  vertical-align: middle;
}

/* FIX: Ensure Font Awesome font icons render correctly */
.kfci-floating-contact__trigger-icon i,
.kfci-floating-contact__item-icon i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  line-height: 1;
}

.kfci-floating-contact__trigger-text {
  white-space: nowrap;
}

/* Hover effects (selectable in Style > Trigger Button > Hover) */
.kfci-fc-hover-scale .kfci-floating-contact__trigger:hover {
  transform: scale(1.08);
}
.kfci-fc-hover-lift .kfci-floating-contact__trigger:hover {
  transform: translateY(-4px);
}
.kfci-fc-hover-shake .kfci-floating-contact__trigger:hover {
  animation: kfci-fc-shake 0.5s ease;
}

@keyframes kfci-fc-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}

/* ---------- Glow animation ---------- */
.kfci-floating-contact--glow .kfci-floating-contact__trigger {
  animation: kfci-fc-glow var(--kfci-fc-glow-speed) ease-in-out infinite;
}

@keyframes kfci-fc-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--kfci-fc-glow-color);
  }
  50% {
    box-shadow: 0 0 var(--kfci-fc-glow-spread)
      calc(var(--kfci-fc-glow-spread) / 2) var(--kfci-fc-glow-color);
  }
}

/* ---------- Pulse ring ---------- */
.kfci-floating-contact__pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: var(--kfci-fc-pulse-color);
  animation: kfci-fc-pulse-ring calc(var(--kfci-fc-glow-speed) * 1.4)
    cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes kfci-fc-pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  80% {
    transform: scale(1.7);
    opacity: 0;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

/* ---------- Entrance animations ---------- */
.kfci-floating-contact--entrance-fade-in-up {
  animation: kfci-fc-fade-in-up 0.6s ease both;
  animation-delay: var(--kfci-fc-entrance-delay);
}
.kfci-floating-contact--entrance-fade-in {
  animation: kfci-fc-fade-in 0.6s ease both;
  animation-delay: var(--kfci-fc-entrance-delay);
}
.kfci-floating-contact--entrance-zoom-in {
  animation: kfci-fc-zoom-in 0.5s ease both;
  animation-delay: var(--kfci-fc-entrance-delay);
}

@keyframes kfci-fc-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes kfci-fc-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes kfci-fc-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Panel ---------- */
.kfci-floating-contact__panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 32px);
  background-color: #101317;
  border-radius: 14px;
  padding: 20px;
  box-sizing: border-box;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s;
  z-index: 2;
}

.kfci-fc-pos-bottom-left .kfci-floating-contact__panel,
.kfci-fc-pos-top-left .kfci-floating-contact__panel,
.kfci-fc-pos-middle-left .kfci-floating-contact__panel {
  right: auto;
  left: 0;
}

.kfci-fc-pos-top-right .kfci-floating-contact__panel,
.kfci-fc-pos-top-left .kfci-floating-contact__panel {
  bottom: auto;
  top: calc(100% + 14px);
}

.kfci-floating-contact--open .kfci-floating-contact__panel,
.kfci-floating-contact--open-hover:hover .kfci-floating-contact__panel {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Panel animation variants (all share the same visible-state rule above) */
.kfci-fc-panel-anim-fade .kfci-floating-contact__panel {
  transform: none;
}
.kfci-fc-panel-anim-scale .kfci-floating-contact__panel {
  transform: scale(0.9);
  transform-origin: bottom right;
}
.kfci-fc-panel-anim-scale.kfci-floating-contact--open
  .kfci-floating-contact__panel,
.kfci-fc-panel-anim-scale.kfci-floating-contact--open-hover:hover
  .kfci-floating-contact__panel {
  transform: scale(1);
}

.kfci-floating-contact__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: #9aa0a8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.kfci-floating-contact__title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.kfci-floating-contact__subtitle {
  font-size: 13px;
  color: #b3b7bd;
  margin: 0 0 16px;
  line-height: 1.5;
}

/* ---------- Contact items ---------- */
.kfci-floating-contact__items {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kfci-fc-divider-yes .kfci-floating-contact__item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.kfci-floating-contact__item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  border-radius: 8px;
  padding: 6px;
  margin: -6px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.kfci-floating-contact__item-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #e4002b;
  color: #fff;
  /* FIX: Ensure icons inside are centered and visible */
  font-size: 16px;
}

.kfci-fc-icon-circle .kfci-floating-contact__item-icon {
  border-radius: 100%;
}
.kfci-fc-icon-rounded .kfci-floating-contact__item-icon {
  border-radius: 8px;
}
.kfci-fc-icon-square .kfci-floating-contact__item-icon {
  border-radius: 0;
}

.kfci-floating-contact__item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kfci-floating-contact__item-label {
  font-size: 12px;
  color: #9aa0a8;
  line-height: 1.4;
}

.kfci-floating-contact__item-value {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .kfci-floating-contact__trigger,
  .kfci-floating-contact__pulse-ring,
  .kfci-floating-contact--glow .kfci-floating-contact__trigger,
  .kfci-floating-contact--entrance-fade-in-up,
  .kfci-floating-contact--entrance-fade-in,
  .kfci-floating-contact--entrance-zoom-in {
    animation: none !important;
  }
}
