/* ═══════════════════════════════════════════════════════
   ESRS FAB — Floating Action Button Styles (fab.css)
   Loaded globally via base_core.html / style.css
   Design: premium glassmorphism speed-dial
═══════════════════════════════════════════════════════ */

/* Hide native-share elements when Web Share API is unavailable */
/* (JS will also hide them, this is the CSS fallback) */
@supports not (display: share) {
  /* Intentionally empty — JS handles this at runtime */
}
/* .native-share-only hidden by JS in fab.js when navigator.share is falsy */

/* Suppress FAB when filter sheet is open */
body.filter-sheet-open #esrs-fab {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ── Root container ── */
#esrs-fab {
  position: fixed;
  left: 24px;
  bottom: 28px;
  z-index: 100002;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

/* ── Action stack (items grow upward above trigger) ── */
#esrs-fab-actions {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

/* ── Individual action pill ── */
.esrs-fab-item {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-height: 52px;
  padding: 6px 22px 6px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--c-text, #1F2937);
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 8px 28px rgba(15, 23, 42, 0.11),
    0 2px 8px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: none;
  /* Hidden by default — animate in on open */
  opacity: 0;
  transform: translateX(-18px) scale(0.9);
  transition:
    opacity 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Open: reveal with staggered spring bounce */
#esrs-fab.is-open #esrs-fab-actions {
  pointer-events: auto;
}
#esrs-fab.is-open .esrs-fab-item {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
/* Stagger: bottom item (nth-child(1) in column-reverse) appears first */
#esrs-fab.is-open .esrs-fab-item:nth-child(1) { transition-delay: 0.00s; }
#esrs-fab.is-open .esrs-fab-item:nth-child(2) { transition-delay: 0.06s; }
#esrs-fab.is-open .esrs-fab-item:nth-child(3) { transition-delay: 0.12s; }
#esrs-fab.is-open .esrs-fab-item:nth-child(4) { transition-delay: 0.18s; }

/* Hover lift */
.esrs-fab-item:hover {
  transform: translateX(5px) scale(1.02) !important;
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.15),
    0 4px 14px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  color: var(--c-text, #1F2937);
}

/* Color-specific hover text accents */
.esrs-fab-whatsapp:hover  { color: #0b8043; }
.esrs-fab-share:hover     { color: #026FC9; }
.esrs-fab-help:hover      { color: #4F46E5; }
.esrs-fab-faq:hover       { color: #D97706; }

/* ── Icon sphere ── */
.esrs-fab-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 4px 12px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Glossy sheen overlay */
.esrs-fab-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 25%,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.12) 48%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

.esrs-fab-icon svg,
.esrs-fab-icon i {
  position: relative;
  z-index: 2;
  width: 20px !important;
  height: 20px !important;
  color: #fff;
}

/* Icon gradient fill variants */
.esrs-fab-icon--whatsapp {
  background: linear-gradient(145deg, #43e97b 0%, #25D366 38%, #0b8043 100%);
}
.esrs-fab-icon--share {
  background: linear-gradient(145deg, #74b9ff 0%, #00A3FF 38%, #026FC9 100%);
}
.esrs-fab-icon--help {
  background: linear-gradient(145deg, #a29bfe 0%, #6366F1 38%, #4F46E5 100%);
}
.esrs-fab-icon--faq {
  background: linear-gradient(145deg, #fdcb6e 0%, #FBBF24 38%, #D97706 100%);
}

/* Hover icon micro-scale */
.esrs-fab-item:hover .esrs-fab-icon {
  transform: scale(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 8px 20px rgba(15, 23, 42, 0.24);
}

/* ── Share submenu wrapper ── */
.esrs-fab-share-wrap {
  position: relative;
}

/* ── Share submenu popup ── */
#esrs-fab-share-menu {
  position: absolute;
  left: calc(100% + 12px);
  bottom: 0;
  min-width: 210px;
  background: rgba(255, 255, 255, 0.99);
  border: 1px solid rgba(229, 231, 235, 0.92);
  border-radius: 20px;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.13),
    0 4px 16px rgba(15, 23, 42, 0.06);
  padding: 8px 0;
  z-index: 100003;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px) scale(0.95);
  transform-origin: bottom left;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
  pointer-events: none;
}
#esrs-fab-share-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.esrs-share-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 18px;
  background: transparent;
  border: none;
  color: var(--c-text, #1F2937);
  font-size: 0.92rem;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.esrs-share-item:hover {
  background: rgba(192, 10, 39, 0.05);
  color: var(--c-primary, #C00A27);
}
.esrs-share-item svg,
.esrs-share-item i {
  width: 16px !important;
  height: 16px !important;
  color: var(--c-text-light, #6B7280);
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.esrs-share-item:hover svg,
.esrs-share-item:hover i {
  color: var(--c-primary, #C00A27);
}
.esrs-share-divider {
  height: 1px;
  background: rgba(229, 231, 235, 0.8);
  margin: 5px 0;
}

/* ── Primary trigger button ── */
#esrs-fab-trigger {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--c-primary, #C00A27) 0%, #e8103a 55%, #f03256 100%);
  color: #fff;
  box-shadow:
    0 18px 42px rgba(192, 10, 39, 0.35),
    0 6px 16px rgba(192, 10, 39, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Inner gloss ring */
#esrs-fab-trigger::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 28% 22%,
    rgba(255, 255, 255, 0.38) 0%,
    rgba(255, 255, 255, 0.0) 60%
  );
  pointer-events: none;
}

/* Ambient pulse ring */
#esrs-fab-trigger::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(192, 10, 39, 0.28);
  animation: esrsFabPulse 3s ease-out infinite;
  pointer-events: none;
}
@keyframes esrsFabPulse {
  0%   { transform: scale(1);    opacity: 0.65; }
  65%  { transform: scale(1.38); opacity: 0;    }
  100% { transform: scale(1.38); opacity: 0;    }
}
#esrs-fab.is-open #esrs-fab-trigger::after {
  animation: none;
}

#esrs-fab-trigger:hover {
  transform: translateY(-3px) scale(1.07);
  box-shadow:
    0 26px 52px rgba(192, 10, 39, 0.42),
    0 8px 20px rgba(192, 10, 39, 0.26);
}
#esrs-fab-trigger:active {
  transform: scale(0.94);
}

/* ── Trigger icon cross-fade ── */
.esrs-fab-trigger-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.esrs-fab-trigger-icon svg,
.esrs-fab-trigger-icon i {
  width: 24px !important;
  height: 24px !important;
}
.esrs-fab-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.55);
}
#esrs-fab.is-open .esrs-fab-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.55);
}
#esrs-fab.is-open .esrs-fab-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ── Mobile (≤600px) ── */
@media (max-width: 600px) {
  #esrs-fab {
    left: 14px !important;
    bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    gap: 10px;
  }
  #esrs-fab-trigger {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
  }
  .esrs-fab-item {
    min-height: 47px !important;
    padding: 5px 15px 5px 5px !important;
    gap: 10px !important;
    font-size: 0.92rem !important;
  }
  .esrs-fab-icon {
    width: 37px !important;
    height: 37px !important;
    min-width: 37px !important;
  }
  #esrs-fab-share-menu {
    left: 0 !important;
    right: auto !important;
    bottom: calc(100% + 10px) !important;
    min-width: 190px !important;
  }
}

/* ── Tablet (601–900px) ── */
@media (min-width: 601px) and (max-width: 900px) {
  #esrs-fab {
    left: 18px !important;
    bottom: 22px !important;
  }
}
