/* styles.css */
:root {
  --font-body: System UI, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: Arial, sans-serif;

  --bg-page: #F8F9FA;
  --bg-panel: #FFFFFF;

  --color-primary: #5F4CD9;
  --color-primary-dark: #4A3CAE;
  --color-on-primary: #FFFFFF;

  --border: rgba(0, 0, 0, 0.12);
  --text-muted: #4B5563;
  --text-primary: #1F2937;
  --spinner-bg: rgba(0, 0, 0, 0.2);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* Centraliza verticalmente */
}

/* Header */
.header {
  display: flex;
  align-items: center;
  background-color: var(--color-primary); /* Cor principal da Simula Health */
  color: var(--color-on-primary);
  padding: 10px 20px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
}

.header-logo {
  height: 40px; /* Ajuste a altura conforme necessário */
  width: auto; /* Mantém a proporção da imagem */
  margin-left: 20px;
}

.header-title {
  font-size: 24px;
  font-weight: bold;
  margin: 0 0 0 15px; /* Margem à esquerda para afastar o título da logo */
}

.version-container {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}
/* Ajustando o corpo da página para não cobrir o conteúdo com o header fixo */
.dashboard {
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh; /* Ocupa toda a altura da tela */
  background-color: var(--color-primary); /* Fundo roxo para cobrir o rodapé */
  padding-top: 70px; /* Espaço para o header fixo */
}

/* Menu lateral */
.sidebar {
  width: 250px;
  background-color: var(--color-primary); /* Cor principal da Simula Health */
  color: white;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  height: 100%; /* Ocupa toda a altura do dashboard */
  border-top: 30px solid rgba(255, 255, 255, 0.2); /* Linha esmaecida no topo */
}

.sidebar h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

.menu-btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.1); /* Botões com transparência */
  color: var(--color-on-primary);
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 5px;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

.menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.2); /* Efeito hover suave */
}

/* Área de conteúdo */
.content {
  position: relative;
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: white; /* Fundo branco para o conteúdo */
}

/* Estilos da tabela */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* Larguras fixas para as colunas */
}

table, th, td {
  border: 1px solid #ddd;
}

th, td {
  text-align: left;
  padding: 8px;
  overflow: hidden; /* Oculta conteúdo excedente */
  text-overflow: ellipsis; /* Adiciona '...' para indicar corte */
  white-space: nowrap; /* Impede quebra automática de linha */
}

th {
  background-color: #5F4CD9; /* Cor principal da Simula Health */
  color: white;
}

/* Estilos do formulário de login */
.login-container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: 0 auto; /* Centraliza o container */
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: #333333; /* Cor de texto escuro */
}

input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

button {
  background-color: var(--color-primary); /* Cor principal da Simula Health */
  color: var(--color-on-primary);
  border: none;
  padding: 0.75rem;
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: var(--color-primary-dark); /* Tom mais escuro para hover */
}

.register-link {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.register-link a {
  color: #5F4CD9; /* Cor principal da Simula Health */
  text-decoration: none;
}

.register-link a:hover {
  text-decoration: underline;
}

/* === Loading Spinner === */
.loading-spinner,
.loading-spinner2 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: auto;
}

.loading-spinner::before,
.loading-spinner2::before {
  content: '';
  width: 50px;
  height: 50px;
  border: 6px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-spinner::after,
.loading-spinner2::after {
  content: '';
}

.loading-spinner > .spinner,
.loading-spinner2 > .spinner {
  display: none;
}

.spinner {
  border: 6px solid rgba(0, 0, 0, 0.15);
  border-top: 6px solid var(--color-primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.offline-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  text-align: center;
}

.offline-card {
  max-width: 400px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.offline-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.4rem;
}

.offline-card p {
  margin: 0 0 16px;
  color: #4b5563;
}

/* Classe para esconder elementos */
.hidden {
  display: none;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Espaçamento entre os botões */
}

.primary-btn {
  background-color: #5F4CD9; /* Cor principal da Simula Health */
  color: white;
}

.primary-btn:hover {
  background-color: #4A3CAE; /* Tom mais escuro para hover */
}

.secondary-btn {
  background-color: #FFFFFF;
  color: #5F4CD9; /* Cor principal da Simula Health */
  border: 1px solid #5F4CD9; /* Borda com a cor principal */
}

.secondary-btn:hover {
  background-color: #F8F9FA; /* Fundo cinza claro para hover */
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px;
}

.toggle-label {
  font-size: 16px;
  font-weight: bold;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 25px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 25px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4CAF50;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Fundo escuro transparente */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);

  display: none; /* Força o uso do Flexbox */
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

/* Container do conteúdo do modal */
.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

/* Animação de entrada suave */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Espaçamento e estilo dos labels */
.modal-content label {
  display: block;
  margin-top: 16px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 14px;
}

/* Inputs e selects */
.modal-content input,
.modal-content select {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  border-radius: 5px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

/* Botão de fechar (X) no canto superior direito */
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 20px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.modal-close:hover {
  color: #000;
}

.modal-content button[type="submit"] {
  margin-top: 24px;
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  padding: 12px;
  width: 100%;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.modal-content button[type="submit"]:hover {
  background-color: var(--color-primary-dark);
}


.close-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  cursor: pointer;
}

.btn-save {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Toolbar dentro do modal para ações rápidas (linha única) */
.modal-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

/* Botões de ação menores dentro do modal (não expandem para 100%) */
.modal-content .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  background: #5F4CD9;
  color: #FFFFFF;
}

.modal-content .btn-action:hover {
  filter: brightness(0.95);
}

/* Cores específicas */
.modal-content .btn-danger {
  background: #fc7380;
  color: white;
}

.modal-content .btn-warning {
  background: #f7b854;
  color: white;
}

.modal-content .btn-secondary {
  background: #6c757d;
  color: white;
}

.table-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* Espaço entre os botões */
}

.table-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
  width: auto; /* Garante que o botão não ocupe toda a largura */
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-actions .edit-btn {
  color: #007bff; /* Azul para edição */
}

.table-actions .delete-btn {
  color: #fc7380; /* Vermelho para deletar */
}

.table-actions button:hover {
  opacity: 0.7;
}


.user-controls {
  display: flex;
  align-items: center;
  gap: 10px; /* Espaço entre o input e o botão */
  margin-bottom: 15px; /* Espaço abaixo do conjunto */
}

#searchUsers {
  flex: 7; /* Equivale a 70% */
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#createBtn {
  flex: 3; /* Equivale a 20% */
  font-size: 16px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
}

#createBtn:hover {
  background-color: #218838;
}

/* Controles de paginação */
.pagination {
  display: flex;
  justify-content: center-left;
  gap: 8px;
  flex-direction: row;
  margin-top: 16px;
  flex-wrap: nowrap;
  overflow-x: auto; /* Permite rolagem horizontal se necessário */
}

.pagination button {
  background-color: #007bff;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  width: auto; /* Permite que o botão ajuste sua largura */

}

.pagination button.active {
  background-color: #0056b3;
  font-weight: bold;
}

.pagination button:disabled {
  background-color: #ccc;
  cursor: default;
}

.btn-extra {
  margin-top: 12px; /* dá um respiro acima */
  display: block;   /* quebra linha certinho */
}

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #fff;
  padding: 20px;
  width: 70%;
  max-width: 900px;
  border-radius: 8px;
}
.training-container {
  display: flex;
  gap: 20px;
}
.training-list {
  flex: 1;
  border: 1px solid #ddd;
  padding: 10px;
  max-height: 400px;
  overflow-y: auto;
}
.training-list ul {
  list-style: none;
  padding: 0;
}
.training-list li {
  cursor: pointer;
  padding: 5px;
  border-bottom: 1px solid #eee;
}
.training-list li:hover {
  background: #f0f0f0;
}

.hidden {
  display: none !important;
}

.dashboard-container {
  padding: 20px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.card {
  background: #f8fafc;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.card h3 {
  font-size: 1rem;
  color: #333;
}
.card p {
  font-size: 1.6rem;
  font-weight: bold;
  color: #0077cc;
}

.section {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 25px;
}

.recent-users-table {
  width: 100%;
  border-collapse: collapse;
}
.recent-users-table th, .recent-users-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
}
.recent-users-table th {
  background: #f0f0f0;
  text-align: left;
}

.filters {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  background: #f5f5f5;
  padding: 10px 15px;
  border-radius: 8px;
}

.filters label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 500;
}

.filters input[type="date"] {
  padding: 5px;
  margin-top: 3px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.filters button {
  padding: 8px 12px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.filters button:hover {
  background: #125a9c;
}

#searchInput {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
}

.btn-export {
  background: #1e88e5;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-export:hover {
  background: #1565c0;
}

/* === Page Header Styles (Progress Page) === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  gap: 20px;
}

.page-title-section {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.page-icon {
  font-size: 2.5rem;
  opacity: 0.8;
  margin-top: 4px;
}

.page-title-content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.page-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 280px;
}

.org-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.org-select {
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 280px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

.org-select:focus {
  outline: none;
  border-color: var(--color-primary-dark);
  background-color: var(--color-primary-dark);
  box-shadow: 0 0 0 3px rgba(95, 76, 217, 0.2);
}

.org-select:hover {
  border-color: var(--color-primary-dark);
  background-color: var(--color-primary-dark);
}

#token-simula-container button {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

