/* ═══════════════════════════════════════════════════
   MOAI – Folha de Estilos Principal
   Tema: Verde Esmeralda + Dourado (Dark Premium)
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Variáveis ──────────────────────────────────── */
:root {
  --verde:          #0B8F4D;
  --verde-escuro:   #076B3A;
  --verde-claro:    #12C063;
  --verde-bg:       #0B1F15;
  --dourado:        #D4AF37;
  --dourado-claro:  #F0D060;
  --dourado-escuro: #A88A20;
  --branco:         #FFFFFF;
  --cinza-claro:    #F4F5F7;
  --cinza-medio:    #9CA3AF;
  --cinza-escuro:   #374151;
  --preto-suave:    #111827;
  --sidebar-bg:     #0D1F17;
  --sidebar-w:      260px;
  --card-bg:        rgba(255,255,255,0.05);
  --card-borda:     rgba(212,175,55,0.2);
  --sombra:         0 8px 32px rgba(0,0,0,0.4);
  --raio:           12px;
  --raio-lg:        20px;
  --transicao:      all .25s ease;
}

/* ─── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--preto-suave);
  color: var(--branco);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Fundo com imagem ───────────────────────────── */
body.com-fundo {
  background-image: url('../images/fundo.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
body.com-fundo::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(11,31,21,.92) 0%, rgba(11,31,21,.78) 100%);
  z-index: 0;
}
body.com-fundo > * { position: relative; z-index: 1; }

/* ─── Scrollbar customizada ──────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--verde-bg); }
::-webkit-scrollbar-thumb { background: var(--verde); border-radius: 3px; }

/* ════════════════════════════════════════════════════
   LAYOUT PRINCIPAL (sidebar + conteúdo)
   ════════════════════════════════════════════════════ */

.layout-principal {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────── */
.barra-lateral {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(212,175,55,.15);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transicao);
}

.barra-lateral .logo-area {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(212,175,55,.12);
  display: flex;
  align-items: center;
  gap: 12px;
}

.barra-lateral .logo-area img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
}

.barra-lateral .logo-area .nome-app {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--verde-claro), var(--dourado));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.nav-menu { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-item { display: block; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transicao);
}

.nav-link:hover {
  background: rgba(11,143,77,.15);
  color: var(--branco);
  border-left-color: var(--verde);
}

.nav-link.ativo {
  background: rgba(11,143,77,.2);
  color: var(--verde-claro);
  border-left-color: var(--dourado);
}

.nav-link i { width: 20px; text-align: center; font-size: 1rem; }

.nav-separador {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 8px 16px;
}

.nav-rotulo {
  padding: 8px 20px 4px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

/* Perfil do usuário (rodapé sidebar) */
.sidebar-usuario {
  padding: 16px 20px;
  border-top: 1px solid rgba(212,175,55,.12);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--verde);
  object-fit: cover;
}

.sidebar-usuario-info { flex: 1; min-width: 0; }
.sidebar-usuario-info .nome {
  font-size: .85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-usuario-info .perfil {
  font-size: .72rem; color: var(--dourado); font-weight: 500;
}

/* ─── Área de conteúdo ───────────────────────────── */
.area-conteudo {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  background: rgba(13,31,23,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212,175,55,.12);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 99;
}

.topbar-titulo { font-size: 1.1rem; font-weight: 600; }

.topbar-acoes { display: flex; align-items: center; gap: 12px; }

.pagina-conteudo { padding: 28px; flex: 1; }

/* ════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════ */

.card-moai {
  background: var(--card-bg);
  border: 1px solid var(--card-borda);
  border-radius: var(--raio-lg);
  backdrop-filter: blur(16px);
  padding: 24px;
  transition: var(--transicao);
  box-shadow: var(--sombra);
}

.card-moai:hover {
  transform: translateY(-3px);
  border-color: rgba(212,175,55,.4);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}

/* Cards de estatísticas */
.card-stat {
  display: flex;
  align-items: center;
  gap: 18px;
}

.card-stat-icone {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.card-stat-icone.verde    { background: rgba(11,143,77,.25); color: var(--verde-claro); }
.card-stat-icone.dourado  { background: rgba(212,175,55,.2); color: var(--dourado); }
.card-stat-icone.vermelho { background: rgba(239,68,68,.2);  color: #f87171; }
.card-stat-icone.azul     { background: rgba(59,130,246,.2); color: #60a5fa; }
.card-stat-icone.roxo     { background: rgba(139,92,246,.2); color: #a78bfa; }

.card-stat-valor { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.card-stat-rotulo { font-size: .8rem; color: var(--cinza-medio); font-weight: 500; margin-top: 2px; }

/* ════════════════════════════════════════════════════
   ORGANOGRAMA
   ════════════════════════════════════════════════════ */

.organograma { padding: 20px 0; }

.org-nivel {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  margin-bottom: 40px;
}

.org-nivel::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 50%; right: 50%;
  height: 20px;
  border-left: 2px dashed rgba(212,175,55,.3);
}

.org-linha-h {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.card-participante-org {
  width: 120px;
  text-align: center;
  cursor: pointer;
  transition: var(--transicao);
}

.card-participante-org:hover { transform: translateY(-4px); }

.org-avatar-wrap {
  position: relative;
  width: 70px; height: 70px;
  margin: 0 auto 10px;
}

.org-avatar-wrap img {
  width: 70px; height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--verde);
}

.org-avatar-wrap .badge-status {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
}

.badge-status.ativo     { background: var(--verde-claro); }
.badge-status.inativo   { background: var(--cinza-medio); }
.badge-status.eliminado { background: #f87171; }

.org-nome {
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-badge {
  display: inline-block;
  font-size: .65rem;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  font-weight: 600;
}

.org-badge.recebeu  { background: rgba(156,163,175,.2); color: var(--cinza-medio); }
.org-badge.ativo    { background: rgba(18,192,99,.15); color: var(--verde-claro); }
.org-badge.aguardando { background: rgba(11,143,77,.2); color: #4ade80; }

/* ════════════════════════════════════════════════════
   BOTÕES
   ════════════════════════════════════════════════════ */

.btn-moai {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--raio);
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transicao);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primario {
  background: linear-gradient(135deg, var(--verde), var(--verde-escuro));
  color: var(--branco);
  box-shadow: 0 4px 16px rgba(11,143,77,.35);
}
.btn-primario:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(11,143,77,.5);
  color: var(--branco);
}

.btn-dourado {
  background: linear-gradient(135deg, var(--dourado), var(--dourado-escuro));
  color: var(--preto-suave);
  box-shadow: 0 4px 16px rgba(212,175,55,.3);
}
.btn-dourado:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212,175,55,.45);
  color: var(--preto-suave);
}

.btn-contorno {
  background: transparent;
  color: var(--branco);
  border: 1px solid rgba(255,255,255,.25);
}
.btn-contorno:hover {
  border-color: var(--verde);
  color: var(--verde-claro);
  background: rgba(11,143,77,.1);
}

.btn-perigo {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.3);
}
.btn-perigo:hover {
  background: rgba(239,68,68,.3);
  transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════
   FORMULÁRIOS
   ════════════════════════════════════════════════════ */

.campo-grupo { margin-bottom: 20px; }

.campo-rotulo {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--cinza-medio);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.campo-input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--raio);
  padding: 11px 16px;
  color: var(--branco);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transicao);
}

.campo-input:focus {
  outline: none;
  border-color: var(--verde);
  background: rgba(11,143,77,.08);
  box-shadow: 0 0 0 3px rgba(11,143,77,.15);
}

.campo-input::placeholder { color: rgba(255,255,255,.3); }

.campo-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239CA3AF' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ════════════════════════════════════════════════════
   TABELAS
   ════════════════════════════════════════════════════ */

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

.tabela-moai thead th {
  background: rgba(11,143,77,.15);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--verde-claro);
  border-bottom: 1px solid rgba(11,143,77,.2);
}

.tabela-moai tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: var(--transicao);
}

.tabela-moai tbody tr:hover {
  background: rgba(255,255,255,.04);
}

.tabela-moai td { padding: 13px 16px; vertical-align: middle; }

/* ════════════════════════════════════════════════════
   BADGES / TAGS
   ════════════════════════════════════════════════════ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

.tag-ativo     { background: rgba(18,192,99,.15); color: #4ade80; border: 1px solid rgba(18,192,99,.25); }
.tag-inativo   { background: rgba(156,163,175,.1); color: var(--cinza-medio); border: 1px solid rgba(156,163,175,.2); }
.tag-eliminado { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.tag-lance     { background: rgba(212,175,55,.15); color: var(--dourado); border: 1px solid rgba(212,175,55,.2); }
.tag-sorteio   { background: rgba(139,92,246,.15); color: #a78bfa; border: 1px solid rgba(139,92,246,.2); }

/* ════════════════════════════════════════════════════
   BARRA DE PROGRESSO DO CICLO
   ════════════════════════════════════════════════════ */

.barra-progresso-ciclo {
  background: rgba(255,255,255,.08);
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.barra-progresso-ciclo .preenchimento {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--verde), var(--dourado));
  transition: width 1s ease;
}

/* ════════════════════════════════════════════════════
   TIMELINE DO HISTÓRICO
   ════════════════════════════════════════════════════ */

.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--verde), rgba(212,175,55,.3));
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--dourado);
  border: 2px solid var(--sidebar-bg);
  box-shadow: 0 0 8px rgba(212,175,55,.5);
}

.timeline-item .card-moai { padding: 16px 20px; }

.timeline-item .data-evento {
  font-size: .75rem;
  color: var(--cinza-medio);
  margin-bottom: 4px;
}

.timeline-item .titulo-evento {
  font-weight: 700;
  font-size: 1rem;
  color: var(--dourado);
}

/* ════════════════════════════════════════════════════
   TELA DE LOGIN
   ════════════════════════════════════════════════════ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(13,31,23,.85);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(212,175,55,.2);
  border-radius: 24px;
  padding: 44px 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { width: 80px; height: 80px; border-radius: 18px; }
.login-logo h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #12C063, #D4AF37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 12px;
}
.login-logo p {
  font-size: .82rem;
  color: var(--cinza-medio);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════
   ROLETA
   ════════════════════════════════════════════════════ */

.roleta-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

#canvas-roleta {
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(212,175,55,.4), 0 0 120px rgba(11,143,77,.2);
  border: 4px solid var(--dourado);
}

.roleta-ponteiro {
  font-size: 2.5rem;
  color: var(--dourado);
  filter: drop-shadow(0 0 12px rgba(212,175,55,.8));
  animation: pulsar 1s ease-in-out infinite alternate;
}

@keyframes pulsar {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}

.vencedor-reveal {
  text-align: center;
  animation: aparecer .5s ease;
}

@keyframes aparecer {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ════════════════════════════════════════════════════
   ALERTAS INTERNOS
   ════════════════════════════════════════════════════ */

.alerta {
  padding: 14px 18px;
  border-radius: var(--raio);
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.alerta-sucesso { background: rgba(18,192,99,.12); border: 1px solid rgba(18,192,99,.25); color: #4ade80; }
.alerta-erro    { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25);  color: #f87171; }
.alerta-aviso   { background: rgba(251,191,36,.1);  border: 1px solid rgba(251,191,36,.25); color: #fbbf24; }
.alerta-info    { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.25); color: #60a5fa; }

/* ════════════════════════════════════════════════════
   LOADER / OVERLAY
   ════════════════════════════════════════════════════ */

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,31,21,.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-circulo {
  width: 56px; height: 56px;
  border: 4px solid rgba(212,175,55,.2);
  border-top-color: var(--dourado);
  border-radius: 50%;
  animation: girar .8s linear infinite;
}

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

/* ════════════════════════════════════════════════════
   AVATAR SELETOR
   ════════════════════════════════════════════════════ */

.avatar-grade {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.avatar-opcao {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transicao);
  overflow: hidden;
}

.avatar-opcao:hover { border-color: var(--verde); transform: scale(1.08); }
.avatar-opcao.selecionado { border-color: var(--dourado); box-shadow: 0 0 12px rgba(212,175,55,.6); }
.avatar-opcao img { width: 100%; height: 100%; object-fit: cover; }

/* ════════════════════════════════════════════════════
   RESPONSIVIDADE
   ════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .barra-lateral {
    transform: translateX(-100%);
  }
  .barra-lateral.aberta {
    transform: translateX(0);
  }
  .area-conteudo {
    margin-left: 0;
  }
  .pagina-conteudo { padding: 16px; }
  .card-stat-valor { font-size: 1.5rem; }
  .login-card { padding: 32px 24px; }
}

/* ─── Utilitários ────────────────────────────────── */
.texto-verde   { color: var(--verde-claro) !important; }
.texto-dourado { color: var(--dourado) !important; }
.texto-cinza   { color: var(--cinza-medio) !important; }
.texto-erro    { color: #f87171 !important; }

.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }

.separador {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,.3), transparent);
  margin: 24px 0;
}
