/* Importação de Fontes: Syne (Cabeçalhos/Displays) e DM Sans (Corpo do texto) */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');
/* Importação de Ícones Material Symbols do Google */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');

/**
 * Variáveis Globais (Padrão: Modo Escuro / Dark Mode)
 * O design base utiliza o conceito de Glassmorphism (vidro fosco) e paletas em Zinc-950.
 */
:root {
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* ── Fundos (Backgrounds) ── */
  --bg: #09090b; /* Fundo principal: True Dark (Zinc-950) sem tons azulados */
  --bg-2: rgba(255, 255, 255, 0.03); /* Fundo sutil para cartões */
  --bg-3: rgba(255, 255, 255, 0.06); /* Fundo intermediário (hover/foco) */
  --bg-4: rgba(255, 255, 255, 0.09); /* Fundo destacado */
  --border: rgba(255, 255, 255, 0.08); /* Bordas translúcidas */
  --border-hover: rgba(255, 255, 255, 0.16); /* Bordas em hover */

  --input-bg: rgba(255,255,255,0.05);
  --input-border: rgba(255,255,255,0.08);
  --input-bg-focus: rgba(255,255,255,0.07);

  /* ── Textos ── */
  --text-primary: #F9FAFB; /* Branco para alto contraste */
  --text-secondary: #9CA3AF; /* Cinza médio para textos secundários */
  --text-muted: #6B7280; /* Cinza escuro para placeholders e notas */

  /* ── Cores Temáticas e Semânticas ── */
  --accent: #bef264; /* Verde Limão (Cor primária/Sucesso/Botões principais) */
  --accent-dim: rgba(190, 242, 100, 0.12); /* Fundo com opacidade reduzida do verde limão */
  --accent-glow: rgba(190, 242, 100, 0.25); /* Sombra de brilho (Neon Glow) para o verde limão */

  --red: #f87171; /* Soft red for expenses */
  --red-dim: rgba(248, 113, 113, 0.12);
  --blue: #22d3ee; /* Cyan */
  --blue-dim: rgba(34, 211, 238, 0.12);
  --amber: #fde047; /* Bright yellow */
  --amber-dim: rgba(253, 224, 71, 0.12);
  --purple: #c084fc; /* Soft purple */
  --purple-dim: rgba(192, 132, 252, 0.12);

  /* ── Componentes de Layout Base ── */
  --sidebar-bg: rgba(9, 9, 11, 0.75); /* Fundo translúcido do Menu Lateral */
  --header-bg: rgba(9, 9, 11, 0.5); /* Fundo translúcido do Cabeçalho Superior */

  /* Bordas arredondadas padrão */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Sombreamentos para efeito de vidro */
  --shadow-card: 0 8px 32px rgba(0,0,0,0.25), inset 0 0.5px 0 rgba(255,255,255,0.06);
  --shadow-glow: 0 0 60px rgba(74,222,128,0.08);

  /* Filtros de desfoque */
  --glass-blur: blur(20px);
  --glass-blur-strong: blur(32px);

  /* Medidas de layout */
  --sidebar-w: 240px;
  --header-h: 64px;
}

/**
 * Variáveis Temáticas (Modo Claro / Light Mode)
 * Sobrescreve as variáveis do :root quando o atributo data-theme for "light".
 */
[data-theme="light"] {
  --bg: #eef2f7;
  --bg-2: rgba(255,255,255,0.65);
  --bg-3: rgba(255,255,255,0.45);
  --bg-4: rgba(255,255,255,0.7);
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.14);

  --input-bg: rgba(0,0,0,0.03);
  --input-border: rgba(0,0,0,0.12);
  --input-bg-focus: rgba(0,0,0,0.06);

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  --accent: #16a34a;
  --accent-dim: rgba(22,163,74,0.12);
  --accent-glow: rgba(22,163,74,0.2);

  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.12);
  --blue: #2563eb;
  --blue-dim: rgba(37,99,235,0.12);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.12);
  --purple: #7c3aed;
  --purple-dim: rgba(124,58,237,0.12);

  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --header-bg: rgba(255, 255, 255, 0.5);

  --shadow-card: 0 8px 32px rgba(0,0,0,0.06), inset 0 0.5px 0 rgba(255,255,255,0.8);
}

/* ── Reset CSS Básico ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

/* ── Corpo da Página (Body) ── */
body {
  font-family: var(--font-body);
  background: var(--bg);
  /* Efeito de iluminação radial no fundo */
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(190,242,100,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 100%, rgba(255,255,255,0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 30%, rgba(190,242,100,0.02) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased; /* Suavização de fontes no Webkit */
  max-width: 100vw;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Normalização de elementos */
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font-body); }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ── Customização da Barra de Rolagem (Scrollbar) ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

/* ── Tipografia e Utilitários de Texto ── */
.display { font-family: var(--font-display); }

/* Cabeçalhos (Headings) */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; }

/* Tamanhos de Fonte */
.text-sm   { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 18px; }
.text-2xl  { font-size: 22px; }
.text-3xl  { font-size: 28px; }
.text-4xl  { font-size: 36px; }

/* Cores de Texto Dinâmicas */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-red       { color: var(--red); }
.text-blue      { color: var(--blue); }
.text-amber     { color: var(--amber); }

/* Pesos de Fonte (Font Weights) */
.font-400 { font-weight: 400; }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }

/* ── Classes Utilitárias de Layout (estilo Tailwind) ── */
.flex   { display: flex; }
.grid   { display: grid; }
.block  { display: block; }
.hidden { display: none !important; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-col  { flex-direction: column; }
.flex-1    { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.w-full   { width: 100%; }
.h-full   { height: 100%; }
.min-h-screen { min-height: 100vh; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.p-8  { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Cartões Glassmorphism (Glass Cards) ── */
.card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.card-hover {
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.card-hover:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3), inset 0 0.5px 0 rgba(255,255,255,0.08);
}

/* ── Botões (Buttons) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #bef264, #a3e635);
  color: #0a0c10;
  border: none;
  box-shadow: 0 4px 16px rgba(190,242,100,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #d9f99d, #bef264);
  box-shadow: 0 6px 24px rgba(190,242,100,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.18); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ── Entradas de Texto e Formulários (Inputs & Forms) ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }

.form-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px rgba(74,222,128,0.08);
  background: var(--input-bg-focus);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input::-webkit-calendar-picker-indicator { filter: invert(0.5); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8099' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Force options to have a solid background, preventing invisible text in native dropdowns */
option {
  background: var(--bg);
  color: var(--text-primary);
}

/* ── Distintivos e Etiquetas (Badges) ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.badge-green  { background: var(--accent-dim);  color: var(--accent); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-amber  { background: var(--amber-dim);  color: var(--amber); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-muted  { background: var(--bg-4); color: var(--text-secondary); }

/* ── Divider ─────────────────────────────── */
.divider { height: 0.5px; background: var(--border); }

/* ── Loader Embutido (Spinner) ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Notificações Flutuantes (Toasts) ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(15,20,35,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toast-in 0.3s ease;
  min-width: 240px;
}
.toast-success { border-left: 3px solid var(--accent); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Caixas de Diálogo (Modals) ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s ease;
}
.modal-overlay.hidden {
  display: none;
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s ease;
}
.modal {
  background: rgba(15,20,35,0.85);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), inset 0 0.5px 0 rgba(255,255,255,0.06);
  animation: modal-in 0.25s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Empty state ─────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.empty-icon {
  width: 56px; height: 56px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 4px;
}

/* ── Skeleton ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Navegação e Menu Lateral (Sidebar) ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.page-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-body { padding: 32px; }

/* ── Nav link ────────────────────────────── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: all 0.18s;
}
.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}
.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
  box-shadow: inset 0 0 0 0.5px rgba(74,222,128,0.15);
}
.nav-link .nav-icon { font-size: 16px; width: 18px; text-align: center; }

/* ── Stat card ───────────────────────────── */
.stat-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  min-width: 0;
  transition: border-color 0.25s, transform 0.25s;
}
.stat-card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
}
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-top: 8px; }
.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-change { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 3px; margin-top: 6px; }
.stat-change.up   { color: var(--accent); }
.stat-change.down { color: var(--red); }

/* ── Tabelas (Tables) ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody td { padding: 12px 16px; font-size: 14px; }

/* ── Category dot ────────────────────────── */
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Avatar ──────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(74,222,128,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--accent);
  font-family: var(--font-display);
  flex-shrink: 0;
}

/* ── Animations ──────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.animate-in {
  animation: fade-up 0.4s ease both;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }

/* ── Responsividade (Media Queries) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .page-header { padding: 0 16px; }
  #menu-toggle { display: block !important; }
}

/* ── Hide Sensitive Values ────────────────── */
[data-hide-values] .sensitive-value {
  filter: blur(8px);
  user-select: none;
  transition: filter 0.25s ease;
  cursor: pointer;
}
[data-hide-values] .sensitive-value:hover {
  filter: blur(3px);
}
[data-hide-values] .sensitive-value:active {
  filter: none;
}
[data-hide-values] .sensitive-value.revealed {
  filter: none;
}

/* Eye toggle button in header */
.visibility-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.visibility-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.visibility-toggle.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(190,242,100,0.2);
}

