/*
 * EZ Connect — Floating Actions
 *
 * Both mobile and desktop use the same FAB (bottom-right) + panel pattern:
 *
 *   Mobile  (< 768 px): panel slides up as a full-width bottom sheet.
 *   Desktop (≥ 768 px): panel appears as a compact 248 px card above the FAB.
 *
 * Panel structure (shared across breakpoints):
 *   ┌─────────────────────────┐
 *   │ [logo] Business Name    │  .ez-fa__brand
 *   ├─────────────────────────┤
 *   │ [ Order Online →      ] │  .ez-fa__cta--order   (accent)
 *   │ [ Book a Table        ] │  .ez-fa__cta--reserve (glass)
 *   │ [ Rewards & Profile   ] │  .ez-fa__cta--rewards (glass)
 *   ├─────────────────────────┤
 *   │  📞  Call Us            │  .ez-fa__util--call
 *   │  📍  Get Directions     │  .ez-fa__util--directions
 *   │  🤖  Ask Our AI         │  .ez-fa__util--ai
 *   └─────────────────────────┘
 *
 * Theme bridge: --ez-host-accent-color set by frontend.js postMessage.
 * All selectors scoped under .ez-fa. No bare element selectors.
 */

/* ── Custom properties ──────────────────────────────────────────────────── */
.ez-fa {
  --ez-fa-accent:   var(--ez-host-accent-color, var(--ez-host-primary-color, #0B1437));
  --ez-fa-text:     #ffffff;
  --ez-fa-surface:  #1e293b;
  --ez-fa-hover:    rgba(255,255,255,.09);
  --ez-fa-radius:   16px;
  --ez-fa-shadow:   0 8px 32px rgba(0,0,0,.26);
  --ez-fa-z:        9999;
  --ez-fa-safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ── FAB — visible on every screen size ─────────────────────────────────── */
.ez-fa__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: calc(20px + var(--ez-fa-safe-bot));
  right: 20px;
  z-index: var(--ez-fa-z);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--ez-fa-accent);
  color: var(--ez-fa-text);
  cursor: pointer;
  box-shadow: var(--ez-fa-shadow);
  padding: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.ez-fa__fab:hover,
.ez-fa__fab:focus-visible {
  outline: none;
  transform: scale(1.08);
  box-shadow: 0 14px 44px rgba(0,0,0,.32);
}

.ez-fa__fab:focus-visible {
  box-shadow: 0 0 0 3px rgba(255,255,255,.85), var(--ez-fa-shadow);
}

/* Business logo image inside FAB */
.ez-fa__fab-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: opacity 160ms ease;
  pointer-events: none;
}

/* Fork-knife fallback icon */
.ez-fa__fab-icon--default {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  position: relative;
  z-index: 1;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.ez-fa__fab-icon--default svg {
  width: 100%;
  height: 100%;
}

/* Close × fades in when panel is open */
.ez-fa__fab-icon--close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.ez-fa__fab-icon--close svg {
  width: 100%;
  height: 100%;
}

.ez-fa[data-open="true"] .ez-fa__fab-img,
.ez-fa[data-open="true"] .ez-fa__fab-icon--default {
  opacity: 0;
}

.ez-fa[data-open="true"] .ez-fa__fab-icon--close {
  display: flex;
}

/* ── Backdrop — mobile only ──────────────────────────────────────────────── */
.ez-fa__backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--ez-fa-z) - 1);
  background: rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.ez-fa[data-open="true"] .ez-fa__backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel — mobile default: full-width bottom sheet ────────────────────── */
.ez-fa__panel {
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--ez-fa-z);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ez-fa-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
  padding-bottom: var(--ez-fa-safe-bot);
  /* Hidden: below viewport */
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transform-origin: bottom center;
  transition: opacity 300ms cubic-bezier(0.32, 0.72, 0, 1),
              transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

.ez-fa[data-open="true"] .ez-fa__panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Drag-handle pill (mobile visual affordance) */
.ez-fa__panel-handle {
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.25);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

/* ── Brand header ───────────────────────────────────────────────────────── */
.ez-fa__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.ez-fa__brand-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ez-fa__brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ez-fa__brand-logo svg {
  width: 20px;
  height: 20px;
  opacity: .75;
}

.ez-fa__brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ez-fa-text);
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* ── CTA buttons ────────────────────────────────────────────────────────── */
.ez-fa__ctas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.ez-fa__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  text-align: center;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: filter 140ms ease, transform 100ms ease;
}

.ez-fa__cta:hover {
  filter: brightness(1.14);
  transform: translateY(-1px);
}

.ez-fa__cta:active {
  transform: translateY(0);
  filter: brightness(0.92);
}

.ez-fa__cta:focus-visible {
  outline: 2px solid rgba(255,255,255,.7);
  outline-offset: 2px;
}

.ez-fa__cta svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Primary: Order Online */
.ez-fa__cta--order {
  background: var(--ez-fa-accent);
  color: var(--ez-fa-text);
}

/* Secondary: Reservations + Rewards */
.ez-fa__cta--reserve,
.ez-fa__cta--rewards {
  background: rgba(255,255,255,.1);
  color: var(--ez-fa-text);
  border: 1px solid rgba(255,255,255,.14);
}

.ez-fa__cta--reserve:hover,
.ez-fa__cta--rewards:hover {
  background: rgba(255,255,255,.16);
  filter: none;
  transform: translateY(-1px);
}

/* ── Utility rows ───────────────────────────────────────────────────────── */
.ez-fa__utils {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.ez-fa__util {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease, color 140ms ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.ez-fa__util + .ez-fa__util {
  border-top: 1px solid rgba(255,255,255,.06);
}

.ez-fa__util:hover,
.ez-fa__util:focus-visible {
  background: var(--ez-fa-hover);
  color: var(--ez-fa-text);
  outline: none;
}

.ez-fa__util:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4);
}

.ez-fa__util-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .75;
}

.ez-fa__util-icon svg {
  width: 100%;
  height: 100%;
}

/* ── Desktop overrides (≥ 768 px) ───────────────────────────────────────── */
@media (min-width: 768px) {
  /* No backdrop on desktop — click-outside closes panel */
  .ez-fa__backdrop {
    display: none;
  }

  .ez-fa__fab {
    bottom: calc(24px + var(--ez-fa-safe-bot));
    right: 24px;
    width: 56px;
    height: 56px;
  }

  /* Compact card instead of bottom sheet */
  .ez-fa__panel {
    bottom: calc(24px + 56px + 10px + var(--ez-fa-safe-bot));
    right: 24px;
    left: auto;           /* CRITICAL: clears mobile left: 0 */
    width: 256px;
    max-height: none;
    overflow-y: visible;
    border-radius: var(--ez-fa-radius);
    box-shadow: var(--ez-fa-shadow);
    padding-bottom: 0;
    transform: translateY(8px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 200ms ease, transform 200ms ease;
  }

  .ez-fa[data-open="true"] .ez-fa__panel {
    transform: translateY(0) scale(1);
  }

  /* Hide drag handle on desktop */
  .ez-fa__panel-handle {
    display: none;
  }

  /* Slightly smaller text for desktop compact card */
  .ez-fa__brand-name { font-size: 13px; }
  .ez-fa__brand-logo { width: 36px; height: 36px; border-radius: 8px; }
  .ez-fa__brand { padding: 14px 16px 12px; gap: 10px; }
  .ez-fa__ctas { padding: 12px 14px; gap: 7px; }
  .ez-fa__cta { padding: 10px 14px; font-size: 13px; border-radius: 10px; }
  .ez-fa__cta svg { width: 15px; height: 15px; }
  .ez-fa__util { padding: 10px 16px; font-size: 13px; gap: 12px; }
  .ez-fa__util-icon { width: 18px; height: 18px; }
  .ez-fa__brand-logo svg { width: 18px; height: 18px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ez-fa__fab,
  .ez-fa__panel,
  .ez-fa__backdrop,
  .ez-fa__fab-img,
  .ez-fa__fab-icon--default {
    transition: none;
  }
}
