/**
 * Alves Finança Familiar — Estilos Base & Reset
 * Desenvolvido por Juliano Alves
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* Moldura Mobile-First (Emula dispositivo mobile no desktop) */
#app-root {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-surface);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
}

@media (min-width: 481px) {
  body {
    background-color: var(--bg-app);
    padding: 20px 0;
  }
  #app-root {
    min-height: calc(100vh - 40px);
    border-radius: 36px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
  }
}

/* Header fixo do App / Status Bar */
.app-header {
  padding: max(var(--space-md), var(--safe-top)) var(--space-lg) var(--space-xs);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface);
}

.app-main {
  flex: 1;
  padding: 0 var(--space-lg) calc(var(--touch-target-min) + var(--space-2xl) + var(--safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.text-title-lg {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.text-title-md {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.text-title-sm {
  font-size: 16px;
  font-weight: 600;
}

.text-body {
  font-size: 14px;
  color: var(--text-primary);
}

.text-caption {
  font-size: 12px;
  color: var(--text-secondary);
}

.text-micro {
  font-size: 11px;
  color: var(--text-secondary);
}

.text-bold {
  font-weight: 600;
}

.text-medium {
  font-weight: 500;
}

/* Utilitários Flexbox & Grid */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2xs { gap: var(--space-2xs); }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Carrossel Horizontal sem scrollbar feia */
.carousel-horizontal {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-2xs);
  margin: 0 calc(-1 * var(--space-lg));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel-horizontal::-webkit-scrollbar {
  display: none;
}

/* Estado Vazio Amigável (PRD §25) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-subtle);
  margin: var(--space-md) 0;
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: var(--space-xs);
  opacity: 0.7;
}

.empty-state-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* Animações e Transições Rápidas */
.fade-in {
  animation: fadeIn 200ms ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loader / Spinner minimalista */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  margin: var(--space-xl) auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
