/* ============================================================
   Components
   Back-to-top button, badge/pill, tooltips, global flash
   messages, Material Icons / Symbols fallback.
   ============================================================ */

/* Badge / pill helpers */
.gf-pill-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background-color: var(--gf-color-primary-soft);
  color: var(--gf-color-primary);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: calc(20px + env(safe-area-inset-right, 0px));
  width: 50px;
  height: 50px;
  background-color: var(--gf-color-primary);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1020;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  /* Same anti-shrinkage protection as .material-icons (see block below),
     applied separately so we don't override the 'Material Symbols Outlined'
     font-family that Google Fonts ships for this class. */
  flex-shrink: 0;
}

.back-to-top:hover {
  background-color: var(--gf-color-primary-hover);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Desktop: reposiciona acima do badge reCAPTCHA (que fica em right:0; bottom:14px)
   para evitar sobreposição visual. No mobile o badge é ocultado via CSS específico
   da página de detalhe, então mantemos a posição padrão. */
@media (min-width: 992px) {
  .back-to-top {
    bottom: 88px;
  }
}

/* Mobile dashboard: stack vertical no canto inferior direito —
   bottom nav (bottom: 0, ~72 px) → FAB "+" (.dashboard-fab a
   bottom: 5.5rem) → back-to-top acima do FAB. Soma 62 px (50 do
   FAB + ~12 de gap) à baseline do FAB para não sobrepor. */
@media (max-width: 1023.98px) {
  .page-user-dashboard .back-to-top {
    bottom: calc(5.5rem + 62px + env(safe-area-inset-bottom, 0px));
  }
}

/* Tooltip styling for better readability */
.tooltip-inner {
  max-width: 350px;
  text-align: left;
  white-space: pre-line;
  line-height: 1.6;
  padding: 0.75rem 1rem;
}

.tooltip {
  font-size: 0.875rem;
}

/* Global flash messages */
.global-messages {
  background-color: var(--bs-body-bg, #ffffff);
  color: var(--gf-color-neutral-900);
  transition: opacity 0.3s ease;
}

.global-messages__alert {
  --global-message-accent: rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0;
  border: none;
  background-color: transparent;
  color: var(--bs-alert-color, inherit);
  box-shadow: none;
  padding: 0.75rem 1.1rem 0.75rem 1.45rem;
  border-radius: 0.85rem;
  position: relative;
  isolation: isolate;
}

.global-messages__content {
  flex: 1 1 auto;
  color: inherit;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.global-messages__alert.alert-success .global-messages__content,
.global-messages__alert.alert-success {
  color: var(--gf-color-primary);
  --global-message-accent: rgba(var(--gf-color-primary-rgb), 0.65);
}

.global-messages__alert.alert-info {
  --global-message-accent: rgba(56, 189, 248, 0.55);
}

.global-messages__alert.alert-warning {
  --global-message-accent: rgba(251, 191, 36, 0.6);
}

.global-messages__alert.alert-danger,
.global-messages__alert.alert-error {
  --global-message-accent: rgba(248, 113, 113, 0.7);
}

.global-messages__alert::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 15px 30px -24px rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 0;
}

/* Barra lateral removida - sem ::after */

.global-messages .btn-close {
  float: none;
  margin: 0;
  position: relative;
  z-index: 1;
}

.page-home .global-messages {
  background-color: var(--gf-color-primary);
  color: var(--gf-color-primary-contrast);
}

.page-home .global-messages__alert {
  color: var(--gf-color-primary-contrast);
}

.page-home .global-messages__alert::before {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 18px 32px -28px rgba(0, 0, 0, 0.55);
}

/* Barra lateral removida - sem ::after na home */

.page-home .global-messages__alert .global-messages__content {
  color: inherit;
}

.page-home .global-messages__alert.alert-success .global-messages__content,
.page-home .global-messages__alert.alert-success {
  color: inherit;
}

.page-home .global-messages .btn-close {
  filter: invert(1);
  opacity: 0.75;
}

.page-home .global-messages .btn-close:hover,
.page-home .global-messages .btn-close:focus {
  opacity: 1;
}

/* ============================================================
   Material Icons Fallback
   Ensures icon text is hidden if the font fails to load.
   The font-display: block in Google Fonts should handle this,
   but this provides extra protection against FOIT/FOUT issues.
   ============================================================ */

/* Hide icon text content when fonts are loading or unavailable.
   IMPORTANT: only the .material-icons / .material-icons-outlined families
   share this fallback font-family. .material-symbols-outlined uses a
   distinct Google Font ('Material Symbols Outlined') and MUST NOT be
   pulled into this selector, or Symbols-only glyphs (workspace_premium,
   notifications, etc.) render as clipped text or the wrong icon. */
.material-icons,
.material-icons-outlined {
  font-family: 'Material Icons', 'Material Icons Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  /* Ensure text doesn't show as fallback - overflow hidden clips text */
  overflow: hidden;
  /* Fixed width prevents layout shift */
  width: 1em;
  height: 1em;
  /* In flex containers, prevent the icon box from shrinking below 1em,
     which would otherwise clip the rendered glyph (showing partial text
     like "chedul" / "question_an" instead of the icon glyph). */
  flex-shrink: 0;
}

/* Ensure proper sizing in various contexts */
.material-icons-outlined {
  font-family: 'Material Icons Outlined', sans-serif;
}

/* Success Card (genérico) — extraído para
   ``static/css/components/success_card.css`` (carregado via base.html)
   para manter este arquivo abaixo do limite de 200 linhas. */
