/* ========== FORM USUARIO =========== */

/* ========== LOCALIDADES PERMITIDAS ========== */

.localidades-selector {
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.localidades-selector input {
  width: 100%;
  max-width: 420px; /* Limitar largura máxima */
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
}

.localidades-selector input:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.localidades-lista {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

/* Scrollbar personalizada */
.localidades-lista::-webkit-scrollbar {
  width: 8px;
}

.localidades-lista::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.localidades-lista::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

.localidades-lista::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

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

.subsidiaria-grupo > strong {
  display: block;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
  color: #4527a0;
  border-left: 4px solid #667eea;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15);
}

/* Cabeçalhos de subsidiária */
.localidades-lista > div > strong {
  display: block;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
  color: #4527a0;
  border-left: 4px solid #667eea;
  max-width: 420px; /* Limitar largura máxima */
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.localidade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: white;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.localidade-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #667eea;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.localidade-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateX(4px);
}

.localidade-item:hover::before {
  transform: scaleY(1);
}

.localidade-item.ja-possui {
  opacity: 0.6;
  background: #f5f5f5;
  border-style: dashed;
}

.localidade-item.ja-possui:hover {
  transform: none;
}

.localidade-item span {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.localidade-item button {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.localidade-item button:not(:disabled) {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.localidade-item button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.localidade-item button:not(:disabled):active {
  transform: translateY(0);
}

.localidade-item button:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
  box-shadow: none;
}

/* Localidades Associadas */
.localidades-associadas {
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  min-height: 450px;
  max-height: 450px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.localidades-associadas::-webkit-scrollbar {
  width: 8px;
}

.localidades-associadas::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.localidades-associadas::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

.localidade-usuario-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  margin-bottom: 12px;
  background: white;
  border: 2px solid #e8e8e8;
  border-left: 5px solid #667eea;
  border-radius: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.localidade-usuario-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.localidade-usuario-item .info {
  flex: 1;
}

.localidade-usuario-item .info strong {
  display: block;
  color: #333;
  font-size: 15px;
  margin-bottom: 6px;
  font-weight: 600;
}

.localidade-usuario-item .info small {
  color: #666;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.localidade-usuario-item .info small::before {
  content: '📍';
  font-size: 11px;
}

.localidade-usuario-item button {
  padding: 8px 16px;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.localidade-usuario-item button:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.localidade-usuario-item button:active {
  transform: translateY(0);
}

/* Aviso de lista vazia */
.aviso {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-style: italic;
  font-size: 15px;
}

.aviso::before {
  content: '📭';
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Labels melhorados */
#secaoLocalidades label {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  display: block;
}

/* Contador de localidades */
#countLocalidades {
  color: #667eea;
  font-weight: 700;
  font-size: 18px;
}

/* ========== ESTILOS PARA LOGOUT E USUÁRIO ========== */

/* Informações do usuário no header */
.usuario-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding-right: 20px;
  color: white;
}

/* Botão de logout no header */
.btn-logout {
  background: rgba(255, 255, 255, 0);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-logout:hover {
  background: rgba(212, 13, 13, 0.897);
}

/* Área do usuário no menu lateral */
.usuario-menu {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
}

.usuario-avatar {
  font-size: 2em;
  color: rgba(255, 255, 255, 0.8);
}

.usuario-dados {
  display: flex;
  flex-direction: column;
  color: white;
}

.usuario-dados span {
  font-weight: bold;
  font-size: 0.9em;
  color: white;
}

.usuario-dados small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

/* Container do logout no menu */
.logout-container {
  margin-top: auto;
  padding: 20px;
  position: relative;
  bottom: 20px;
  left: 10px;
  right: 20px;
  height: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Botão de logout no menu lateral */
.btn-logout-menu {
  width: 100%;
  background: rgba(255, 255, 255, 0);
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.btn-logout-menu:hover {
  background: rgba(212, 13, 13, 0.897);
}

/* Ajuste para o header (pode precisar ajustar conforme seu CSS atual) */
header {
  display: flex;
  align-items: center;
}

/* CORREÇÃO TABELA USUÁRIOS */
.table-container {
  overflow-x: auto !important;
  width: 100% !important;
}

#tabelaUsuarios {
  width: 100% !important;
  table-layout: fixed !important;
  min-width: 900px !important;
}

/* ========================================
   ESTILOS PARA USUARIO - TABELA
   ======================================== */
/*ID*/
#tabelaUsuarios th:nth-child(1), 
#tabelaUsuarios td:nth-child(1) {
   width: 60px !important;
   text-align: center; 
}
/*NOME*/
#tabelaUsuarios th:nth-child(2), 
#tabelaUsuarios td:nth-child(2) { 
  width: 280px !important; 
}
/*EMAIL*/
#tabelaUsuarios th:nth-child(3), 
#tabelaUsuarios td:nth-child(3) { 
  width: 300px !important; 
}
/*PERFIL*/
#tabelaUsuarios th:nth-child(4), 
#tabelaUsuarios td:nth-child(4) {
   width: 150px !important;
   text-align: center; 
}
/*LOCALIDADE*/
#tabelaUsuarios th:nth-child(5), 
#tabelaUsuarios td:nth-child(5) { 
  width: 120px !important; 
}
/*ACOES*/
#tabelaUsuarios th:nth-child(6), 
#tabelaUsuarios td:nth-child(6) { 
  width: 100px !important; 
}
/*RESPONSIVIDADE TEXTO LONGO*/
#tabelaUsuarios td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  padding: 8px 10px !important;
}

@media (max-width: 768px) {
  #tabelaUsuarios th:nth-child(4), 
  #tabelaUsuarios td:nth-child(4),
  #tabelaUsuarios th:nth-child(5), 
  #tabelaUsuarios td:nth-child(5) {
    display: none !important;
    text-align: center;
  }
  
  .table-container::before {
    content: '👈 Deslize para ver mais 👉';
    display: block !important;
    background: #e3f2fd !important;
    text-align: center !important;
    padding: 8px !important;
    font-size: 12px !important;
  }
}

/* ========================================
   ANIMAÇÕES E TRANSIÇÕES
   ======================================== */

/* Fade in para elementos de usuário */
.usuario-info,
.usuario-menu {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   ESTADOS E FEEDBACK VISUAL
   ======================================== */

/* Indicador de usuário online */
.usuario-menu::before {
  content: '';
  position: absolute;
  top: 20px;
  right: 20px;
  width: 10px;
  height: 10px;
  background: #28a745;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */
/* Grid responsivo */
@media (max-width: 992px) {
  #secaoLocalidades > div[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  .localidades-associadas,
  .localidades-lista {
    max-height: 300px !important;
  }
}

/* Responsivo - Empilhar em telas pequenas */
@media (max-width: 992px) {
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Tablets e dispositivos menores */
@media (max-width: 768px) {
  .usuario-info {
    padding-right: 10px;
  }
  
  .usuario-info span {
    display: none; /* Esconde nome no mobile */
  }
  
  .btn-logout {
    font-size: 20px;
  }
  
  .usuario-menu {
    padding: 15px;
  }
  
  .usuario-avatar {
    font-size: 30px;
  }
}
