/* ========================================
   GLOBAL.CSS - Estilos Globais, Reset e Base
   ======================================== */

/* 1. Reset Básico e Box-Sizing */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 2. Variáveis Globais */
:root {
  /* Cores */
  --primary-color: #005c97;
  --secondary-color: #00b9f1;
  --background-color: #f4f8fb;
  --text-color: #333;
  
  /* Fonte */
  --font-base: 'Roboto', sans-serif;
  
  /* Espaçamentos e Transições */
  --transition-speed: 0.5s;
  
  /* Largura Máxima do Container */
  --container-max-width: 1200px;
  
  /* Largura da sidebar fixa */
  --sidebar-width: 250px;
  
  /* Altura do header fixo (se houver) */
  --header-height: 50px;
  
  /* Largura colapsada da sidebar (adicionada para consistência) */
  --sidebar-collapsed-width: 60px;
}

/* 3. Estilos Base */
html {
  font-size: 16px; /* 1rem = 16px */
  height: 100%; /* Garante altura total */
}

body {
  font-family: var(--font-base);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100%; /* Garante altura mínima */
  overflow-x: hidden; /* Evita rolagem horizontal no body */
}

/* 4. Imagens e Mídia */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 5. Listas */
ul, ol {
  list-style: none;
}

/* 6. Links */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover,
a:focus {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* 7. Formulários */
input,
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color var(--transition-speed) ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--secondary-color);
  outline: none;
}

/* 8. Classes Utilitárias de Espaçamento */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

/* 9. Tabelas Básicas */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
th,
td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
th {
  background-color: var(--primary-color);
  color: #fff;
}

/* 10. Responsividade Básica */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }
  .container {
    width: 95%;
  }
}
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

/* ========================================
   LAYOUT DO CONTEÚDO
   ======================================== */
.main-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding-left: var(--sidebar-width); /* Ajusta o espaço para a sidebar */
  transition: padding-left var(--transition-speed) ease;
  box-sizing: border-box;
}

body.sidebar-collapsed .main-wrapper {
  padding-left: var(--sidebar-collapsed-width);
}

.content {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  box-sizing: border-box;
  padding: 2rem 1rem 1rem;
  overflow-x: hidden; /* Evita rolagem horizontal no content */
}

/* ========================================
   HEADER FIXO (BARRA TOP)
   ======================================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0; /* Fixe no canto esquerdo da tela */
  right: 0;
  height: var(--header-height);
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  z-index: 998;
  will-change: transform;
  backface-visibility: hidden;
  transition: left var(--transition-speed) ease; /* Opcional, para animação */
}

body.sidebar-collapsed .top-bar {
  left: 0; /* Mantém fixo, ajustando apenas se necessário */
}

/* ========================================
   SIDEBAR FIXA (Base)
   ======================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  transition: width var(--transition-speed) ease, left var(--transition-speed) ease;
  z-index: 999; /* Acima do .content e .top-bar */
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

/* Esconde a scrollbar em navegadores baseados em WebKit (Chrome, Safari, Opera) */
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* Esconde a scrollbar no Firefox, IE e Edge */
* {
  -ms-overflow-style: none; /* IE e Edge */
  scrollbar-width: none;     /* Firefox */
}


/* ========================================
   LOADING GLOBAL
   ======================================== */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 1;
  visibility: visible;
}

.global-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}

/* FIM DO GLOBAL.CSS */