/* ═══════════════════════════════════════════
   MELHORIAS DE USABILIDADE — TIBI Portal
   ═══════════════════════════════════════════ */

/* ── 1. Botão Voltar ao Topo ── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 20px rgba(7, 94, 200, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
}

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

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 28px rgba(7, 94, 200, 0.4);
}

.back-to-top i {
  transition: transform 0.3s ease;
}

.back-to-top:hover i {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
}

/* ── 2. Indicador de Seção Ativa no Menu ── */
.site-header nav a.is-active {
  color: var(--blue);
  background: #f1f7ff;
  box-shadow: inset 0 0 0 1px #dbeafe;
}

.site-header nav a.is-active::before {
  opacity: 1;
}

/* ── 3. Toast de Newsletter ── */
.newsletter-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  z-index: 10000;
  text-align: center;
  max-width: 90vw;
}

.newsletter-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.newsletter-toast i {
  margin-right: 8px;
}

/* ── 4. Estado Vazio de Eventos ── */
.event-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.event-empty-state i {
  font-size: 48px;
  color: #d1d9e6;
  margin-bottom: 16px;
  display: block;
}

.event-empty-state h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px;
}

.event-empty-state p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  max-width: 280px;
  margin-inline: auto;
  line-height: 1.5;
}

/* ── 5. Melhorias Gerais de Responsividade ── */
@media (max-width: 576px) {
  /* Ajustes para telas pequenas */
  .container {
    width: calc(100% - 24px);
  }
  
  /* Menu mobile melhorado */
  .nav-open .site-header nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 16px 16px;
    gap: 8px;
  }
  
  .nav-open .site-header nav a {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    min-height: 44px;
  }
  
  /* Cards menores em mobile */
  .ministries-grid {
    grid-template-columns: 1fr;
  }
  
  /* Footer simplificado */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .footer-nav nav {
    justify-content: center;
  }
  
  .footer-connect .social-row {
    justify-content: center;
  }
  
  .newsletter {
    max-width: 100%;
  }
}

/* ── 6. Animações Suaves ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* ── 7. Melhorias de Acessibilidade ── */
.back-to-top:focus-visible,
.ministries-filter:focus-visible,
.ministries-card-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ── 8. Estado de Carregamento ── */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── 9. Melhorias para Deficiência Visual ── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .back-to-top {
    transform: none !important;
  }
}

/* ── 10. Contraste Melhorado ── */
@media (prefers-contrast: high) {
  .back-to-top {
    border: 2px solid #fff;
  }
  
  .site-header nav a {
    border: 1px solid transparent;
  }
  
  .site-header nav a:hover {
    border-color: var(--blue);
  }
}
