/**
 * Hamta Floating Contact — frontend
 * Scoped UI chrome; kept light for LCP / INP.
 */

.hfc-root {
  --hfc-btn: #54a29e;
  --hfc-btn-hover: #3d7a76;
  --hfc-btn-icon: #ffffff;
  --hfc-z: 99999;
  --hfc-bottom: 24px;
  --hfc-side: 24px;
  --hfc-ink: #1a1a1a;
  --hfc-muted: #64748b;
  --hfc-surface: #ffffff;
  --hfc-border: rgba(229, 231, 235, 0.95);
  --hfc-shadow: 0 18px 40px rgba(47, 101, 98, 0.22);
  --hfc-radius: 18px;

  position: fixed;
  bottom: var(--hfc-bottom);
  z-index: var(--hfc-z);
  /* Inherit site fonts — no extra webfont request from this plugin. */
  font-family: inherit;
  line-height: 1.5;
  direction: rtl;
  contain: layout style;
  pointer-events: none;
}

.hfc-root > * {
  pointer-events: auto;
}

.hfc-pos-right {
  right: var(--hfc-side);
  left: auto;
}

.hfc-pos-left {
  left: var(--hfc-side);
  right: auto;
}

/* Brand badge */
.hfc-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--hfc-brand, #54a29e);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 6px 14px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.hfc-badge--contact,
.hfc-badge--mobile { --hfc-brand: #54a29e; }
.hfc-badge--phone { --hfc-brand: #3d7a76; }
.hfc-badge--whatsapp { --hfc-brand: #25d366; }
.hfc-badge--telegram { --hfc-brand: #229ed9; }
.hfc-badge--rubika { --hfc-brand: #e11d48; }
.hfc-badge--bale { --hfc-brand: #00a651; }
.hfc-badge--eitaa { --hfc-brand: #f97316; }
.hfc-badge--email { --hfc-brand: #b87333; }
.hfc-badge--link { --hfc-brand: #64748b; }
.hfc-badge--contact_page { --hfc-brand: #2f6562; }

.hfc-menu__link.hfc-type-mobile { --hfc-item-brand: #54a29e; }
.hfc-menu__link.hfc-type-phone { --hfc-item-brand: #3d7a76; }
.hfc-menu__link.hfc-type-whatsapp { --hfc-item-brand: #25d366; }
.hfc-menu__link.hfc-type-telegram { --hfc-item-brand: #229ed9; }
.hfc-menu__link.hfc-type-rubika { --hfc-item-brand: #e11d48; }
.hfc-menu__link.hfc-type-bale { --hfc-item-brand: #00a651; }
.hfc-menu__link.hfc-type-eitaa { --hfc-item-brand: #f97316; }
.hfc-menu__link.hfc-type-email { --hfc-item-brand: #b87333; }
.hfc-menu__link.hfc-type-location { --hfc-item-brand: #dc2626; }
.hfc-menu__link.hfc-type-inquiry { --hfc-item-brand: #b87333; }
.hfc-menu__link.hfc-type-link { --hfc-item-brand: #64748b; }
.hfc-menu__link.hfc-type-contact_page { --hfc-item-brand: #2f6562; }

.hfc-badge svg {
  display: block;
}

.hfc-badge__letter {
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}

/* FAB */
.hfc-fab {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--hfc-btn) 0%, var(--hfc-btn-hover) 100%);
  color: var(--hfc-btn-icon);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 28px rgba(47, 101, 98, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  isolation: isolate;
  transform: translateZ(0);
}

.hfc-fab__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--hfc-btn);
  z-index: -1;
  animation: hfc-pulse 2.4s ease-out infinite;
  /* Compositor-friendly; avoid continuous will-change. */
  transform: translateZ(0);
}

.hfc-root.is-open .hfc-fab__pulse {
  animation: none;
  opacity: 0;
}

.hfc-fab:hover,
.hfc-fab:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 18px 34px rgba(47, 101, 98, 0.42);
  outline: none;
}

.hfc-fab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.hfc-fab__icon--close {
  display: none;
  font-size: 34px;
  font-weight: 300;
}

.hfc-root.is-open .hfc-fab__icon--open {
  display: none;
}

.hfc-root.is-open .hfc-fab__icon--close {
  display: inline-flex;
}

/* Hover tip */
.hfc-tip {
  position: absolute;
  bottom: calc(50% - 0px);
  transform: translateY(50%) scale(0.96);
  width: min(240px, calc(100vw - 96px));
  padding: 12px 14px;
  border-radius: 14px;
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 39, 68, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 2;
}

.hfc-pos-right .hfc-tip {
  right: calc(64px + 14px);
  left: auto;
}

.hfc-pos-left .hfc-tip {
  left: calc(64px + 14px);
  right: auto;
}

.hfc-tip::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #1a1a1a;
  transform: translateY(-50%) rotate(45deg);
}

.hfc-pos-right .hfc-tip::after {
  right: -4px;
}

.hfc-pos-left .hfc-tip::after {
  left: -4px;
}

.hfc-tip__title {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 4px;
  color: #fff;
}

.hfc-tip__text {
  display: block;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
}

.hfc-root:hover .hfc-tip,
.hfc-root:focus-within .hfc-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(50%) scale(1);
}

.hfc-root.is-open .hfc-tip {
  opacity: 0 !important;
  visibility: hidden !important;
}

.hfc-popup {
  position: absolute;
  bottom: calc(64px + 14px);
  width: min(320px, calc(100vw - 28px));
  background: var(--hfc-surface);
  border: 1px solid var(--hfc-border);
  border-radius: var(--hfc-radius);
  box-shadow: var(--hfc-shadow);
  overflow: hidden;
  transform-origin: bottom center;
  /* No backdrop-filter — expensive on mobile GPUs. */
  contain: layout paint;
}

.hfc-pos-right .hfc-popup {
  right: 0;
}

.hfc-pos-left .hfc-popup {
  left: 0;
}

.hfc-popup[hidden],
.hfc-popup:not(.is-visible) {
  display: none !important;
}

.hfc-root.is-open .hfc-popup.is-visible {
  display: block !important;
}

.hfc-popup__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, #2f6562 0%, #3d7a76 48%, #54a29e 100%);
  color: #fff;
}

.hfc-popup__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hfc-popup__spark .hfc-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  color: #fff;
}

.hfc-popup__title {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hfc-popup__subtitle {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.88;
  font-weight: 500;
}

.hfc-popup__close {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
}

.hfc-popup__close:hover,
.hfc-popup__close:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.hfc-menu {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: min(62vh, 440px);
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #f7f9f8 0%, #fff 40%);
  -webkit-overflow-scrolling: touch;
}

.hfc-menu__item + .hfc-menu__item {
  margin-top: 6px;
}

.hfc-menu__link {
  --hfc-item-brand: #54a29e;
  display: grid;
  grid-template-columns: 48px 1fr 16px;
  align-items: center;
  column-gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--hfc-ink);
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.hfc-menu__link:hover,
.hfc-menu__link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--hfc-item-brand);
  background: #f8fafc;
  box-shadow: 0 10px 22px rgba(47, 101, 98, 0.12);
  outline: none;
}

.hfc-menu__icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hfc-menu__img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  box-shadow: 0 6px 14px rgba(15, 39, 68, 0.12);
  background: #fff;
}

.hfc-menu__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hfc-menu__label {
  font-size: 14px;
  font-weight: 700;
}

.hfc-menu__meta {
  font-size: 12px;
  color: var(--hfc-muted);
  direction: ltr;
  text-align: right;
  unicode-bidi: plaintext;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hfc-menu__meta--soft {
  direction: rtl;
  text-align: right;
  unicode-bidi: normal;
  opacity: 0.85;
}

.hfc-menu__chev {
  color: #94a3b8;
  font-size: 18px;
  font-weight: 700;
  opacity: 0.7;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.hfc-menu__link:hover .hfc-menu__chev,
.hfc-menu__link:focus-visible .hfc-menu__chev {
  transform: translateX(-3px);
  opacity: 1;
  color: var(--hfc-item-brand);
}

/* Animations — transform/opacity only */
.hfc-anim-fade .hfc-popup.is-visible {
  animation: hfc-fade 0.2s ease;
}

.hfc-anim-scale .hfc-popup.is-visible {
  animation: hfc-scale 0.22s ease;
}

.hfc-anim-slide .hfc-popup.is-visible {
  animation: hfc-slide 0.22s ease;
}

.hfc-anim-bounce .hfc-popup.is-visible {
  animation: hfc-bounce 0.4s ease;
}

@keyframes hfc-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hfc-scale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes hfc-slide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hfc-bounce {
  0% { opacity: 0; transform: scale(0.9); }
  60% { opacity: 1; transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes hfc-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

@media (max-width: 480px) {
  .hfc-fab {
    width: 58px;
    height: 58px;
  }

  .hfc-popup {
    bottom: calc(58px + 12px);
  }

  .hfc-pos-right .hfc-tip,
  .hfc-pos-left .hfc-tip {
    /* Tip less useful on touch; keep for focus-within only via CSS above. */
    width: min(200px, calc(100vw - 88px));
  }
}

/* Save CPU/battery on coarse pointers (phones): pause idle pulse until interaction. */
@media (hover: none) and (pointer: coarse) {
  .hfc-fab__pulse {
    animation: none;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hfc-fab,
  .hfc-menu__link,
  .hfc-popup.is-visible,
  .hfc-fab__pulse,
  .hfc-menu__chev,
  .hfc-tip {
    transition: none !important;
    animation: none !important;
  }
}
