/* =====================================================================
   7. FAB GROUP
   Fixed bottom-right floating action buttons.
   Three stacked FABs: Chat (primary) + Download + Preset (secondary).
   ===================================================================== */

.m-fab-group {
  position: fixed;
  z-index: 9000;
  bottom: calc(16px + var(--m-safe-bottom));
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
}

/* Shared FAB base */
.m-fab-btn {
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--m-fab-bg);
  box-shadow: var(--m-fab-shadow);
  background-image: linear-gradient(to bottom, var(--specular) 0%, transparent 50%);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease),
              background 0.2s var(--ease), opacity 0.3s var(--ease);
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

.m-fab-btn:not(.m-fab-chat):hover {
  background: var(--m-fab-bg-hover);
  box-shadow: var(--m-fab-shadow-hover);
}

.m-fab-btn:active {
  transform: scale(0.94);
  transition-duration: 0.1s;
}

/* Chat FAB - primary, largest */
.m-fab-chat {
  width: var(--m-fab-size);
  height: var(--m-fab-size);
}

.m-fab-chat:hover {
  transform: scale(1.06);
}

.m-fab-chat.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* FAB wrapper (holds btn + popup + label) */
.m-fab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-content: center;
}

/* Secondary FABs */
.m-fab-secondary {
  width: var(--m-fab-secondary-size);
  height: var(--m-fab-secondary-size);
}

.m-fab-secondary svg {
  width: 20px;
  height: 20px;
  color: var(--text-0);
}

/* Staggered entrance — initial state (animation delays in _visual-fab.css) */
.m-fab-preset-wrap,
.m-fab-cost-wrap,
.m-fab-share-wrap,
.m-fab-download-wrap,
.m-fab-fullscreen-wrap,
.m-slide-nav {
  opacity: 0;
  transform: scale(0) translateY(20px);
}

.m-fab-cost-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Zero state — dimmed */
.m-fab-cost.cost-zero .m-fab-cost-value {
  opacity: 0.45;
}

/* Indicator dot — active preset */
.m-fab-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg-solid);
  pointer-events: none;
}



/* When chat panel is open, hide ENTIRE FAB group (chat header has close btn) */
.m-fab-group.chat-open {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0s 0.2s;
}

/* Chat FAB icon swap */
.m-fab-chat-icon {
  width: 24px;
  height: 24px;
  color: var(--text-0);
  transition: transform 0.3s var(--ease-spring), opacity 0.2s var(--ease);
}

.m-fab-chat.open .m-fab-chat-icon {
  transform: scale(0) rotate(90deg);
  opacity: 0;
}

.m-fab-chat-close-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  color: var(--text-0);
  transform: scale(0) rotate(-90deg);
  opacity: 0;
  transition: transform 0.3s var(--ease-spring), opacity 0.2s var(--ease);
}

.m-fab-chat.open .m-fab-chat-close-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

/* Notification badge on FAB */
.m-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform 0.3s var(--ease-spring);
  pointer-events: none;
  border: 2px solid var(--canvas);
}

.m-fab-badge.visible {
  transform: scale(1);
}

/* FAB glass pill labels */
.m-fab-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
  background: var(--m-fab-bg);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease-spring);
}

.m-fab-label.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* FAB popup containers (download + preset) */
.m-fab-popup {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  display: flex;
  gap: 6px;
  background: var(--m-fab-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--m-fab-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease-spring);
  z-index: 9001;
}

.m-fab-popup.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* Popup action buttons */
.m-fab-popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 36px;
  min-width: 44px;
}

.m-fab-popup-btn:hover {
  background: var(--bg-input-hover);
}

.m-fab-popup-btn:active {
  background: var(--accent-subtle);
  transform: scale(0.96);
}

.m-fab-popup-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* "Coming soon" disabled state */
.m-fab-popup-btn--soon {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.m-soon-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  opacity: 0.7;
  margin-left: 2px;
}

/* Preset popup — vertical layout */
.m-fab-popup.m-preset-popup {
  flex-direction: column;
  min-width: 200px;
  max-height: 60vh;
  overflow: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Brand option row */
.m-brand-option {
  justify-content: flex-start !important;
  gap: 10px !important;
}

.m-brand-name {
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Brand color dot */
.m-brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .m-brand-dot {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Coming soon brand — dimmed, non-clickable */
.m-brand-soon {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}

/* Divider between available & coming-soon */
.m-brand-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}


