/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/*                  SISTEMA JESSAMINE - CONTROLE DE CAIXA & CRM                       */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/*  O QUE ESTE ARQUIVO FAZ:                                                           */
/*  Estrutura o layout MOBILE-FIRST da aplicacao!                                      */
/*  No celular, apresenta a barra de navegacao inferior fixa (estilo app nativo       */
/*  Instagram/WhatsApp) facil de alcancar com o polegar. No computador ou tablet,      */
/*  transforma-se automaticamente em uma elegante barra lateral (Sidebar) corporativa. */
/*                                                                                    */
/*  VARIAVEIS E CLASSES PRINCIPAIS:                                                   */
/*  * '.app-container': Envolve toda a aplicacao com layout flex responsivo.           */
/*  * '.top-bar': Cabecalho fixo superior com logotipo, indicador de sincronizacao     */
/*    online/offline e botao de alternar tema.                                        */
/*  * '.bottom-nav': Barra de menu inferior mobile (oculta no desktop).               */
/*  * '.sidebar': Barra de menu lateral desktop (oculta no celular).                  */
/*  * '.main-content': Area central onde as telas sao renderizadas.                   */
/*                                                                                    */
/*  LOGICA USADA E EXPLICACAO PASSO A PASSO:                                          */
/*  1. Comeca com regras padrao para telas de 320px a 767px (Mobile First).           */
/*  2. O 'padding-bottom' de 80px no conteudo impede que a barra inferior tampe os    */
/*     botoes de lancamento e o resumo do caixa.                                      */
/*  3. Em telas >= 768px (@media), a barra inferior e desativada e a sidebar entra   */
/*     em cena com transicao suave, otimizando o espaco em monitores de PC.           */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Barra Superior (Top Bar) */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Indicador de Status Online / Offline / Sync */
.sync-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  transition: all 0.2s ease;
}

.sync-badge.offline {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

.sync-badge.syncing {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Barra de Navegação Inferior (Mobile Bottom Nav) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 60;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.active svg {
  transform: translateY(-2px);
}

/* Barra Lateral Desktop (Oculta por padrão no celular) */
.sidebar {
  display: none;
}

/* Área Principal de Conteúdo */
.main-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Telas (Views) com visualizacao controlada */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* Adaptacao para Tablet e Desktop (>= 768px) */
@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
  }

  .bottom-nav {
    display: none;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
    z-index: 40;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-left: 6px;
  }

  .sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.15s ease;
  }

  .sidebar-item svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-main);
  }

  .sidebar-item.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
  }

  .sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
  }

  .content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
  }

  .main-content {
    padding: 24px 32px;
    padding-bottom: 32px;
  }
}
