/* ─────────────────────────────────────────────────────────
   FHEERA — WhatsApp Widget
   assets/css/whatsapp-widget.css

   Scoped entirely to #fwa-root.
   References global design tokens from global.css.
   Zero global selector pollution.
───────────────────────────────────────────────────────── */


/* ── Widget-local tokens ─────────────────────────────── */

#fwa-root {
  --fwa-w:              300px;
  --fwa-radius:         13px;
  --fwa-btn-size:       54px;
  --fwa-gap:            12px;

  /* Surfaces */
  --fwa-card:           rgba(13, 13, 13, 0.95);
  --fwa-border:         rgba(255, 255, 255, 0.07);
  --fwa-divider:        rgba(255, 255, 255, 0.045);
  --fwa-hover-surface:  rgba(255, 255, 255, 0.04);

  /* Shadows */
  --fwa-shadow-btn:     0 6px 24px rgba(0, 0, 0, 0.52), 0 2px 6px rgba(0, 0, 0, 0.28);
  --fwa-shadow-card:    0 20px 48px rgba(0, 0, 0, 0.62), 0 6px 16px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.055);

  /* Positioning — safe-area aware */
  --fwa-offset-bottom:  max(24px, env(safe-area-inset-bottom, 24px));
  --fwa-offset-right:   max(24px, env(safe-area-inset-right,  24px));
}


/* ── Root wrapper ────────────────────────────────────── */

#fwa-root {
  position: fixed;
  bottom: var(--fwa-offset-bottom);
  right:  var(--fwa-offset-right);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--fwa-gap);
  pointer-events: none;
}

#fwa-root * {
  box-sizing: border-box;
}


/* ── Popup card ──────────────────────────────────────── */

#fwa-popup {
  width: var(--fwa-w);
  background: var(--fwa-card);
  border: 1px solid var(--fwa-border);
  border-radius: var(--fwa-radius);

  /* Reduced blur for compositing performance */
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);

  overflow: hidden;
  box-shadow: var(--fwa-shadow-card);

  /* Hidden state */
  opacity: 0;
  transform: translateY(14px) scale(0.975);
  transform-origin: bottom right;
  pointer-events: none;

  /* Transition references global easing token */
  transition:
    opacity   0.38s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.38s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1));

  will-change: opacity, transform;
}

#fwa-popup.fwa-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}


/* ── Popup header ────────────────────────────────────── */

.fwa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--fwa-divider);
}

.fwa-header__left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.fwa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.fwa-avatar__icon {
  width: 16px;
  height: 16px;
}

.fwa-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6FCF97;
  border: 1.5px solid #0d0d0d;
  box-shadow: 0 0 5px rgba(111, 207, 151, 0.45);
}

.fwa-brand-block {
  min-width: 0;
}

.fwa-brand {
  /* Uses global --font-heading token */
  font-family: var(--font-heading, 'Cormorant Garamond', serif);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  color: rgba(245, 242, 238, 0.92);
  line-height: 1;
  margin-bottom: 3px;
  white-space: nowrap;
}

.fwa-brand__sub {
  /* Uses global --font-body token */
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 9.5px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(245, 242, 238, 0.28);
  white-space: nowrap;
}

.fwa-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 242, 238, 0.36);
  flex-shrink: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  margin-left: 8px;

  transition:
    background 0.22s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    color      0.22s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform  0.32s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1));
}

.fwa-close:hover {
  background: var(--fwa-hover-surface);
  color: rgba(245, 242, 238, 0.85);
  transform: rotate(90deg);
}

.fwa-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.fwa-close__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}


/* ── Popup body ──────────────────────────────────────── */

.fwa-body {
  padding: 14px 16px 16px;
}


/* ── Message bubble ──────────────────────────────────── */

.fwa-bubble {
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid rgba(255, 255, 255, 0.048);
  border-radius: 9px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.fwa-bubble__text {
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.72;
  color: rgba(245, 242, 238, 0.56);
}

.fwa-bubble__text strong {
  color: rgba(245, 242, 238, 0.88);
  font-weight: 400;
}

.fwa-bubble__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.fwa-bubble__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6FCF97;
  opacity: 0.60;
  flex-shrink: 0;
}

.fwa-bubble__status {
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 9.5px;
  font-weight: 300;
  letter-spacing: 0.09em;
  color: rgba(245, 242, 238, 0.26);
}


/* ── CTA button ──────────────────────────────────────── */

.fwa-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 11px 18px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;

  transition:
    background   0.28s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    border-color 0.28s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform    0.16s ease;
}

.fwa-cta:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
}

.fwa-cta:active {
  transform: scale(0.98);
}

.fwa-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.fwa-cta__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.fwa-cta__label {
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(245, 242, 238, 0.82);
  white-space: nowrap;
}


/* ── Trigger button ──────────────────────────────────── */

#fwa-trigger {
  pointer-events: auto;
  width: var(--fwa-btn-size);
  height: var(--fwa-btn-size);
  border-radius: 50%;
  background: #111112;
  border: none;
  box-shadow: var(--fwa-shadow-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;

  /* Entrance: starts hidden */
  opacity: 0;
  transform: scale(0.72) translateY(10px);

  transition:
    opacity    0.52s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform  0.52s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    box-shadow 0.28s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    background 0.28s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1));
}

/* Subtle inner ring detail */
#fwa-trigger::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.055);
  pointer-events: none;
}

/* Loaded state: visible + idle float */
#fwa-trigger.fwa-loaded {
  opacity: 1;
  transform: scale(1) translateY(0);
  animation: fwa-float 4.8s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)) infinite 2s;
}

#fwa-trigger:hover {
  background: #1c1c1e;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.07);
  animation: none;
  transform: scale(1.05) translateY(-2px) !important;
}

#fwa-trigger:active {
  transform: scale(0.96) !important;
  animation: none;
}

#fwa-trigger:focus-visible {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.16),
    var(--fwa-shadow-btn);
}


/* ── Trigger icon transitions ────────────────────────── */

.fwa-trigger__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition:
    opacity   0.26s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.26s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1));
}

.fwa-trigger__close {
  position: absolute;
  width: 15px;
  height: 15px;
  opacity: 0;
  transform: scale(0.5) rotate(-45deg);
  transition:
    opacity   0.24s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1)),
    transform 0.26s var(--ease-luxury, cubic-bezier(0.16, 1, 0.3, 1));
}

/* Open state: swap to X */
#fwa-root.fwa-open .fwa-trigger__icon {
  opacity: 0;
  transform: scale(0.5) rotate(45deg);
}

#fwa-root.fwa-open .fwa-trigger__close {
  opacity: 0.78;
  transform: scale(1) rotate(0deg);
}


/* ── Idle float keyframe ─────────────────────────────── */

@keyframes fwa-float {
  0%   { transform: scale(1) translateY(0px); }
  44%  { transform: scale(1) translateY(-5px); }
  100% { transform: scale(1) translateY(0px); }
}


/* ── Mobile overrides ────────────────────────────────── */

@media (max-width: 480px) {
  #fwa-root {
    --fwa-w:              calc(100vw - 32px);
    --fwa-btn-size:       50px;
    --fwa-offset-bottom:  max(20px, env(safe-area-inset-bottom, 20px));
    --fwa-offset-right:   max(16px, env(safe-area-inset-right,  16px));
  }
}


/* ── Reduced-motion accessibility ────────────────────── */

@media (prefers-reduced-motion: reduce) {
  #fwa-popup,
  #fwa-trigger,
  .fwa-close,
  .fwa-cta,
  .fwa-trigger__icon,
  .fwa-trigger__close {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}