/* ============================================================
   THEME.CSS - Tema central do sistema
   ------------------------------------------------------------
   Para mudar as cores do sistema inteiro, altere APENAS as
   variáveis abaixo. Tudo se atualiza automaticamente.
   ============================================================ */

:root {
  /* ===== PALETA PRINCIPAL ===== */
  /* Azul-petróleo profundo + menta - moderna e clínica */
  --cor-primaria:        #0d5d62;   /* Azul-petróleo profundo */
  --cor-primaria-clara:  #14a098;   /* Tom médio */
  --cor-primaria-suave:  #e6f4f4;   /* Fundo suave */
  --cor-primaria-escura: #083f43;
  
  --cor-secundaria:        #f0a868;   /* Pêssego suave - acento */
  --cor-secundaria-clara:  #fbdcc0;
  --cor-secundaria-escura: #d4894f;
  
  /* ===== CORES SEMÂNTICAS ===== */
  --cor-sucesso:       #10b981;
  --cor-sucesso-suave: #d1fae5;
  --cor-aviso:         #f59e0b;
  --cor-aviso-suave:   #fef3c7;
  --cor-erro:          #ef4444;
  --cor-erro-suave:    #fee2e2;
  --cor-info:          #3b82f6;
  --cor-info-suave:    #dbeafe;
  
  /* ===== TONS NEUTROS ===== */
  --cor-fundo:           #f7f9fa;
  --cor-fundo-card:      #ffffff;
  --cor-fundo-elevado:   #ffffff;
  --cor-borda:           #e5e9ec;
  --cor-borda-forte:     #cdd5db;
  
  --cor-texto:           #1a2e35;
  --cor-texto-suave:     #5a6e78;
  --cor-texto-fraco:     #94a3b8;
  --cor-texto-inverso:   #ffffff;
  
  /* ===== TIPOGRAFIA ===== */
  --fonte-titulo: 'Fraunces', Georgia, 'Times New Roman', serif;
  --fonte-corpo:  'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fonte-mono:   'JetBrains Mono', 'Courier New', monospace;
  
  /* ===== SOMBRAS ===== */
  --sombra-sm:  0 1px 2px rgba(13, 93, 98, 0.05);
  --sombra-md:  0 4px 12px rgba(13, 93, 98, 0.08);
  --sombra-lg:  0 12px 32px rgba(13, 93, 98, 0.12);
  --sombra-xl:  0 24px 48px rgba(13, 93, 98, 0.16);
  
  /* ===== RAIOS ===== */
  --raio-sm:   6px;
  --raio-md:   10px;
  --raio-lg:   16px;
  --raio-xl:   24px;
  --raio-full: 9999px;
  
  /* ===== ESPAÇAMENTOS ===== */
  --espaco-xs: 0.25rem;
  --espaco-sm: 0.5rem;
  --espaco-md: 1rem;
  --espaco-lg: 1.5rem;
  --espaco-xl: 2.5rem;
  
  /* ===== TRANSIÇÕES ===== */
  --transicao: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transicao-lenta: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* ===== LAYOUT ===== */
  --largura-sidebar: 260px;
  --altura-topbar: 64px;
}

/* ============================================================
   RESET E BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--fonte-corpo);
  font-size: 15px;
  line-height: 1.6;
  color: var(--cor-texto);
  background-color: var(--cor-fundo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--fonte-titulo);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--cor-texto);
  margin-top: 0;
}

a { color: var(--cor-primaria); text-decoration: none; transition: color var(--transicao); }
a:hover { color: var(--cor-primaria-escura); }

/* ============================================================
   LAYOUT - SIDEBAR + TOPBAR
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
  width: var(--largura-sidebar);
  background: linear-gradient(180deg, var(--cor-primaria-escura) 0%, var(--cor-primaria) 100%);
  color: var(--cor-texto-inverso);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: transform var(--transicao);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .logo {
  width: 40px; height: 40px;
  background: var(--cor-secundaria);
  border-radius: var(--raio-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cor-primaria-escura);
  font-family: var(--fonte-titulo);
  font-size: 1.4rem;
  font-weight: 700;
}

.sidebar-brand .nome {
  font-family: var(--fonte-titulo);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.sidebar-brand .versao {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar-nav .nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.5;
  padding: 1rem 0.75rem 0.5rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: rgba(255,255,255,0.75);
  border-radius: var(--raio-md);
  transition: all var(--transicao);
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-nav a.ativo {
  background: rgba(255,255,255,0.14);
  color: white;
  font-weight: 600;
}

.sidebar-nav a.ativo::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--cor-secundaria);
  position: absolute;
  left: 0;
  border-radius: 0 3px 3px 0;
}

.sidebar-nav a { position: relative; }

.sidebar-nav svg, .sidebar-nav i { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem;
}

.sidebar-footer .usuario {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.sidebar-footer .avatar {
  width: 36px; height: 36px;
  background: var(--cor-secundaria);
  color: var(--cor-primaria-escura);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.sidebar-footer .nome-usuario { font-weight: 600; }
.sidebar-footer .perfil-usuario { font-size: 0.75rem; opacity: 0.6; text-transform: capitalize; }

.sidebar-footer .btn-sair {
  display: block;
  text-align: center;
  padding: 0.5rem;
  background: rgba(255,255,255,0.08);
  border-radius: var(--raio-md);
  color: white;
  font-size: 0.85rem;
}

.sidebar-footer .btn-sair:hover { background: rgba(255,255,255,0.16); color: white; }

/* === CONTEÚDO PRINCIPAL === */
.main-content {
  flex: 1;
  margin-left: var(--largura-sidebar);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--altura-topbar);
  background: var(--cor-fundo-card);
  border-bottom: 1px solid var(--cor-borda);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .titulo-pagina {
  font-family: var(--fonte-titulo);
  font-size: 1.4rem;
  margin: 0;
  flex: 1;
}

.topbar .btn-menu-mobile {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--cor-texto);
  cursor: pointer;
}

.conteudo {
  padding: 1.5rem;
  flex: 1;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* === CARDS === */
.card {
  background: var(--cor-fundo-card);
  border: 1px solid var(--cor-borda);
  border-radius: var(--raio-lg);
  padding: 1.5rem;
  box-shadow: var(--sombra-sm);
  transition: box-shadow var(--transicao);
}

.card:hover { box-shadow: var(--sombra-md); }

.card-titulo {
  font-family: var(--fonte-titulo);
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === BOTÕES === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--raio-md);
  font-family: var(--fonte-corpo);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transicao);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primario {
  background: var(--cor-primaria);
  color: white;
}
.btn-primario:hover { background: var(--cor-primaria-escura); color: white; transform: translateY(-1px); box-shadow: var(--sombra-md); }

.btn-secundario {
  background: white;
  color: var(--cor-texto);
  border-color: var(--cor-borda-forte);
}
.btn-secundario:hover { background: var(--cor-fundo); }

.btn-acento {
  background: var(--cor-secundaria);
  color: var(--cor-primaria-escura);
}
.btn-acento:hover { background: var(--cor-secundaria-escura); color: white; }

.btn-perigo { background: var(--cor-erro); color: white; }
.btn-perigo:hover { background: #c81e1e; color: white; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1rem; }
.btn-bloco { width: 100%; }

/* === FORMULÁRIOS === */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--cor-texto-suave);
}

.form-label .obrigatorio { color: var(--cor-erro); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--cor-borda-forte);
  border-radius: var(--raio-md);
  background: white;
  font-family: var(--fonte-corpo);
  font-size: 0.95rem;
  color: var(--cor-texto);
  transition: all var(--transicao);
}

.form-control:focus {
  outline: none;
  border-color: var(--cor-primaria);
  box-shadow: 0 0 0 3px var(--cor-primaria-suave);
}

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a6e78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* === TABELAS === */
.tabela-wrapper {
  overflow-x: auto;
  border-radius: var(--raio-lg);
  border: 1px solid var(--cor-borda);
  background: white;
}

.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.tabela thead th {
  text-align: left;
  padding: 0.85rem 1rem;
  background: var(--cor-fundo);
  color: var(--cor-texto-suave);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--cor-borda);
}

.tabela tbody td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--cor-borda);
}

.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover { background: var(--cor-primaria-suave); }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--raio-full);
  letter-spacing: 0.02em;
}

.badge-sucesso { background: var(--cor-sucesso-suave); color: #047857; }
.badge-aviso   { background: var(--cor-aviso-suave); color: #b45309; }
.badge-erro    { background: var(--cor-erro-suave); color: #b91c1c; }
.badge-info    { background: var(--cor-info-suave); color: #1e40af; }
.badge-neutro  { background: var(--cor-borda); color: var(--cor-texto-suave); }
.badge-primario { background: var(--cor-primaria-suave); color: var(--cor-primaria-escura); }

/* === ALERTAS === */
.alerta {
  padding: 0.85rem 1.1rem;
  border-radius: var(--raio-md);
  margin-bottom: 1rem;
  border-left: 4px solid;
  font-size: 0.92rem;
}

.alerta-sucesso { background: var(--cor-sucesso-suave); border-color: var(--cor-sucesso); color: #065f46; }
.alerta-erro    { background: var(--cor-erro-suave); border-color: var(--cor-erro); color: #991b1b; }
.alerta-aviso   { background: var(--cor-aviso-suave); border-color: var(--cor-aviso); color: #92400e; }
.alerta-info    { background: var(--cor-info-suave); border-color: var(--cor-info); color: #1e3a8a; }

/* === STATS / KPIs === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--cor-borda);
  border-radius: var(--raio-lg);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transicao);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); }

.stat-card .icone {
  width: 44px; height: 44px;
  border-radius: var(--raio-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.85rem;
  background: var(--cor-primaria-suave);
  color: var(--cor-primaria);
}

.stat-card .rotulo {
  font-size: 0.82rem;
  color: var(--cor-texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-card .valor {
  font-family: var(--fonte-titulo);
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--cor-texto);
  line-height: 1.1;
}

.stat-card .variacao {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--cor-sucesso);
  font-weight: 600;
}

.stat-card .variacao.negativo { color: var(--cor-erro); }

/* === CABEÇALHO DE PÁGINA === */
.pagina-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagina-header h1 {
  font-family: var(--fonte-titulo);
  font-size: 1.8rem;
  margin: 0;
}

.pagina-header .subtitulo {
  color: var(--cor-texto-suave);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.pagina-header .acoes { display: flex; gap: 0.5rem; }

/* === BARRA DE FILTROS / BUSCA === */
.barra-filtros {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.busca-wrapper {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.busca-wrapper input {
  padding-left: 2.5rem;
}

.busca-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.5;
}

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */
.login-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top right, var(--cor-primaria-suave) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left, var(--cor-secundaria-clara) 0%, transparent 50%),
    var(--cor-fundo);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: var(--raio-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--sombra-lg);
  border: 1px solid var(--cor-borda);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.login-logo .marca {
  width: 56px; height: 56px;
  background: var(--cor-primaria);
  color: white;
  border-radius: var(--raio-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fonte-titulo);
  font-size: 2rem;
  font-weight: 700;
}

.login-card h1 {
  font-family: var(--fonte-titulo);
  text-align: center;
  font-size: 1.6rem;
  margin: 0.5rem 0 0.25rem;
}

.login-card .subtitulo {
  text-align: center;
  color: var(--cor-texto-suave);
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

.login-card .rodape {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--cor-texto-fraco);
}

/* ============================================================
   RESPONSIVO - CELULAR
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--sombra-xl);
  }
  
  .sidebar.aberto { transform: translateX(0); }
  
  .main-content { margin-left: 0; }
  
  .topbar .btn-menu-mobile { display: block; }
  
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  
  .pagina-header { flex-direction: column; align-items: stretch; }
  
  .conteudo { padding: 1rem; }
  
  .stat-card { padding: 1rem; }
  .stat-card .valor { font-size: 1.5rem; }
  
  .login-card { padding: 1.75rem; }
  
  .tabela { font-size: 0.85rem; }
  .tabela thead th, .tabela tbody td { padding: 0.6rem 0.7rem; }
}

/* Overlay do menu mobile */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.menu-overlay.aberto { display: block; }
