/**
 * action-launcher.css — popover M3 ancorado no FAB.
 * Issue #403, Saulo 2026-06-21.
 */

.action-launcher-popover {
  position: fixed;
  z-index: 1000;
  min-width: 280px;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface-container-lowest, #fff);
  color: var(--on-surface, #1e293b);
  border: 1px solid var(--outline-variant, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 8px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  animation: al-fade-in 120ms ease-out;
}

[data-theme="dark"] .action-launcher-popover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes al-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.al-header {
  font: 600 11px/1 'Inter', system-ui;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--on-surface-variant, #64748b);
  padding: 8px 12px 6px;
}

.al-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  margin: 0;
  border-radius: 8px;
  font: 500 13px 'Inter', system-ui;
  color: var(--on-surface-variant, #64748b);
  transition: background .15s, color .15s;
}

.al-back:hover {
  background: var(--surface-container, #f1f5f9);
  color: var(--on-surface, #1e293b);
}

.al-back .msym {
  font-size: 18px;
}

.al-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.al-list-obras {
  max-height: 320px;
  overflow-y: auto;
}

.al-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: 'Inter', system-ui;
  transition: background .12s;
}

.al-item:hover:not(.al-item-disabled),
.al-item:focus-visible:not(.al-item-disabled) {
  background: var(--surface-container, #f1f5f9);
  outline: none;
}

.al-item:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary, #1e3a5f);
}

.al-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-container, rgba(0, 212, 170, 0.16));
  color: var(--primary, #1e3a5f);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.al-item-icon .msym {
  font-size: 22px;
}

.al-item-disabled .al-item-icon {
  background: var(--surface-container, #f1f5f9);
  color: var(--on-surface-variant, #64748b);
}

.al-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.al-item-label {
  font: 600 14px/1.2 'Inter', system-ui;
  color: var(--on-surface, #1e293b);
}

.al-item-sub {
  font: 400 12px/1.3 'Inter', system-ui;
  color: var(--on-surface-variant, #64748b);
}

.al-item-arrow {
  color: var(--on-surface-variant, #64748b);
  font-size: 20px;
}

.al-item-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.al-item-disabled .al-item-label,
.al-item-disabled .al-item-sub {
  color: var(--on-surface-variant, #64748b);
}

/* Mobile FAB injetado pelo JS — só visível em mobile (≤760px) */
.al-mobile-fab {
  display: none;
}

@media (max-width: 760px) {
  .al-mobile-fab {
    display: inline-grid;
    place-items: center;
    position: fixed;
    right: 20px;
    bottom: 84px; /* acima do bottomnav (~64px) + folga */
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--primary, #1e3a5f);
    color: var(--on-primary, #fff);
    border: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    z-index: 50;
    transition: transform .15s, box-shadow .15s;
  }

  .al-mobile-fab:active {
    transform: scale(0.95);
  }

  .al-mobile-fab .msym {
    font-size: 28px;
  }

  /* Popover mobile ocupa quase a largura toda */
  .action-launcher-popover {
    min-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
}
