@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "GOOD-TIMES";
  src: url("fonts/good-times.otf") format("truetype");
  font-weight: bold;
  font-style: normal;
}

/* Reset básico e configuração viewport */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  width: 100%;
}

body {
  font-family: "Montserrat", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  color: #333;
  min-height: 100vh;
  width: 100vw;
  overflow-x: auto;
}

.login-container {
  max-width: 450px;
  margin: 8vh auto;
  padding: 40px;
  background: #ebf8e7;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-height: 500px;
}

.login-container h1 {
  font-family: "GOOD-TIMES", sans-serif;
  font-weight: bold;
  color: #25691b;
  margin-bottom: 20px;
  text-transform: uppercase;
  font-size: 2.2rem;
}

.login-container h1 span {
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  color: #25691b;
  font-size: 1.8rem;
}

.logo-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 25px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #25691b;
  font-size: 1.1rem;
}

.form-group input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #bdc3c7;
  border-radius: 30px;
  box-sizing: border-box;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #25691b;
  box-shadow: 0 0 10px rgba(37, 105, 27, 0.2);
}

button {
  background-color: #25691b;
  color: rgb(238, 248, 237);
  border: none;
  padding: 16px 30px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  width: 80%;
  margin: 25px auto 0;
  display: block;
  transition: all 0.3s ease;
}

button:hover {
  background-color: #64d354;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(37, 105, 27, 0.3);
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error-message {
  color: #e74c3c;
  margin-top: 20px;
  padding: 12px;
  border-radius: 8px;
  display: none;
  font-weight: 500;
}

.error-message.login-error {
  background-color: #fdecea;
  border-left: 4px solid #e74c3c;
  animation: shake 0.5s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

.success-message {
  color: #25691b;
  background-color: #e8f5e9;
  padding: 12px 20px;
  border-radius: 8px;
  border-left: 4px solid #25691b;
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  animation: fadeIn 0.3s;
  min-width: 300px;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.logout-message {
  color: #27ae60;
  margin: 20px 0;
  padding: 15px;
  background-color: #e8f5e9;
  border-radius: 8px;
  border-left: 4px solid #27ae60;
  display: none;
  font-weight: 500;
}

.login-footer {
  margin-top: 40px;
  color: #4e5657;
  font-size: 0.9em;
  font-weight: 500;
}

/* ==================== DASHBOARD STYLES ==================== */

header {
  background-color: #25691b;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: 70px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-grow: 1;
  justify-content: center;
}

.header-content h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
}

.header-logo {
  height: 50px;
  width: auto;
  position: absolute;
  left: 20px;
}

header #logoutBtn {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
  width: auto;
  margin: 0;
}

header #logoutBtn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* Main content area */
main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 140px);
  width: 100%;
}

section {
  margin-bottom: 3rem;
}

section h2 {
  color: #25691b;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.last-reading {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.reading-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9f7ef 100%);
  padding: 1.5rem;
  border-radius: 10px;
  border-left: 5px solid #25691b;
}

.reading-data p {
  margin: 10px 0;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reading-data strong {
  color: #25691b;
  font-weight: 600;
}

/* Botões do dashboard */
.button-group {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 3rem 0;
  flex-wrap: wrap;
}

.button-group button {
  background: linear-gradient(135deg, #25691b 0%, #2e7d32 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  width: auto;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(37, 105, 27, 0.3);
}

.button-group button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 105, 27, 0.4);
  background: linear-gradient(135deg, #2e7d32 0%, #25691b 100%);
}

/* Gráficos */
.charts-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.charts-section h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: #25691b;
}

.chart-container {
  width: 100%;
}

.lote-selector {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.lote-selector label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 1.1rem;
}

.lote-selector select {
  padding: 10px 15px;
  border: 2px solid #bdc3c7;
  border-radius: 8px;
  background-color: white;
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  min-width: 200px;
}

#loteLabel {
  text-align: center;
  color: #34495e;
  font-size: 1.3rem;
  margin-bottom: 2rem;
  font-weight: 600;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.chart-wrapper {
  background-color: #fafafa;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  min-height: 400px;
}

.chart-wrapper h4 {
  margin: 0 0 1rem 0;
  text-align: center;
  color: #2c3e50;
  font-size: 1.2rem;
  font-weight: 600;
}

/* Ajuste específico para gráfico de pressão */
.chart-row:last-child {
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto;
}

canvas {
  width: 100% !important;
  height: 350px !important;
}

/* Modal personalizado */
.custom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.custom-modal-content {
  background-color: white;
  border-radius: 12px;
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.custom-modal-header {
  padding: 20px 30px;
  border-bottom: 2px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9f7ef 100%);
}

.custom-modal-header h3 {
  margin: 0;
  color: #25691b;
  font-size: 1.5rem;
  font-weight: 600;
}

.custom-modal-body {
  padding: 25px 30px;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 70vh;
}

.custom-modal-footer {
  padding: 20px 30px;
  border-top: 2px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
}

.modal-footer-left {
  color: #666;
  font-size: 1rem;
  font-weight: 500;
}

.modal-footer-left strong {
  color: #25691b;
  font-weight: 600;
}

.custom-close-btn {
  background-color: #25691b;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  font-size: 1rem;
  width: auto;
  min-width: auto;
}

.custom-close-btn:hover {
  background-color: #64d354;
  transform: translateY(-2px);
}

/* Histórico de leituras */
.readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.reading-item {
  background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-left: 5px solid #25691b;
  transition: transform 0.2s;
}

.reading-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.reading-item p {
  margin: 12px 0;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reading-item strong {
  color: #25691b;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state i {
  font-size: 4rem;
  color: #bdc3c7;
  margin-bottom: 20px;
  display: block;
}

/* Formulário de parâmetros */
.parametro-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #25691b;
  font-size: 1rem;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #25691b;
  box-shadow: 0 0 8px rgba(37, 105, 27, 0.2);
}

#parametroForm input {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 1rem;
}

.custom-save-btn {
  background: linear-gradient(135deg, #25691b 0%, #2e7d32 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  margin-right: 15px;
  transition: all 0.3s;
}

.custom-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 105, 27, 0.3);
}

/* Responsividade */
@media (max-width: 1200px) {
  main {
    padding: 1.5rem;
    max-width: 100%;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .login-container {
    margin: 5vh auto;
    padding: 30px 25px;
    max-width: 350px;
  }

  .login-container h1 {
    font-size: 1.8rem;
  }

  .login-container h1 span {
    font-size: 1.4rem;
  }

  header {
    padding: 1rem;
    flex-direction: column;
    gap: 15px;
    min-height: auto;
  }

  .header-content {
    margin-left: 0;
  }

  .header-logo {
    position: static;
    height: 40px;
  }

  main {
    padding: 1rem;
  }

  .button-group {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }

  .button-group button {
    width: 100%;
    max-width: 300px;
  }

  .readings-grid {
    grid-template-columns: 1fr;
  }

  .custom-modal-content {
    width: 98%;
    max-height: 95vh;
  }

  .custom-modal-header,
  .custom-modal-body,
  .custom-modal-footer {
    padding: 15px 20px;
  }

  .parametro-filters {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .lote-selector {
    flex-direction: column;
    gap: 10px;
  }

  .lote-selector select {
    min-width: auto;
    width: 100%;
    max-width: 250px;
  }

  canvas {
    height: 280px !important;
  }
}

/* ==================== ESTILOS DE RELATÓRIOS ==================== */

/* Menu de relatórios */
.relatorios-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.relatorio-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9f7ef 100%);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.relatorio-card:hover {
  border-color: #25691b;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(37, 105, 27, 0.15);
  background: linear-gradient(135deg, #e9f7ef 0%, #d4f1d4 100%);
}

.relatorio-card h4 {
  color: #25691b;
  font-size: 1.2rem;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.relatorio-card p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

/* Filtros de relatórios */
.filtros-auditoria,
.filtros-leituras {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 25px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-row .form-group {
  margin-bottom: 0;
}

/* Resultados dos relatórios */
.resultados-relatorio {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
}

.relatorio-header {
  background-color: #25691b;
  color: white;
  padding: 15px 20px;
  border-radius: 8px 8px 0 0;
  margin: 0;
}

.relatorio-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Tabelas de relatório */
.tabela-container {
  overflow-x: auto;
}

.tabela-relatorio {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tabela-relatorio thead {
  background-color: #f1f1f1;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tabela-relatorio th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: #25691b;
  border-bottom: 2px solid #25691b;
  white-space: nowrap;
}

.tabela-relatorio td {
  padding: 10px 8px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}

.tabela-relatorio tbody tr:hover {
  background-color: #f8f9fa;
}

.tabela-relatorio tbody tr:nth-child(even) {
  background-color: #fbfbfb;
}

/* Status badges */
.status-sucesso {
  background-color: #d4edda;
  color: #155724;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-erro {
  background-color: #f8d7da;
  color: #721c24;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==================== ESTILOS DE RELATÓRIOS E USUÁRIOS ==================== */

/* Menu de relatórios */
.relatorios-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.relatorio-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9f7ef 100%);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.relatorio-card:hover {
  border-color: #25691b;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(37, 105, 27, 0.15);
  background: linear-gradient(135deg, #e9f7ef 0%, #d4f1d4 100%);
}

.relatorio-card h4 {
  color: #25691b;
  font-size: 1.2rem;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.relatorio-card p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

/* Filtros de relatórios */
.filtros-auditoria,
.filtros-leituras {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 25px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-row .form-group {
  margin-bottom: 0;
}

/* Resultados dos relatórios */
.resultados-relatorio {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
}

.relatorio-header {
  background-color: #25691b;
  color: white;
  padding: 15px 20px;
  border-radius: 8px 8px 0 0;
  margin: 0;
}

.relatorio-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Tabelas de relatório */
.tabela-container {
  overflow-x: auto;
}

.tabela-relatorio {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tabela-relatorio thead {
  background-color: #f1f1f1;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tabela-relatorio th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: #25691b;
  border-bottom: 2px solid #25691b;
  white-space: nowrap;
}

.tabela-relatorio td {
  padding: 10px 8px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}

.tabela-relatorio tbody tr:hover {
  background-color: #f8f9fa;
}

.tabela-relatorio tbody tr:nth-child(even) {
  background-color: #fbfbfb;
}

/* Status badges */
.status-sucesso {
  background-color: #d4edda;
  color: #155724;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-erro {
  background-color: #f8d7da;
  color: #721c24;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-neutro {
  background-color: #f8f9fa;
  color: #495057;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==================== ESTILOS DE GERENCIAMENTO DE USUÁRIOS ==================== */

.usuarios-lista h4 {
  color: #25691b;
  margin-bottom: 15px;
  font-size: 1.3rem;
  font-weight: 600;
}

/* Botões pequenos para ações */
.btn-pequeno {
  padding: 6px 12px;
  font-size: 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.btn-promover {
  background-color: #28a745;
  color: white;
}

.btn-promover:hover {
  background-color: #218838;
  transform: translateY(-1px);
}

.btn-remover {
  background-color: #dc3545;
  color: white;
}

.btn-remover:hover {
  background-color: #c82333;
  transform: translateY(-1px);
}

/* Formulário de alteração de senha */
#formAlterarSenha {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

#formAlterarSenha h4 {
  color: #25691b;
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 600;
}

#formAlterarSenha .form-group {
  margin-bottom: 15px;
}

#formAlterarSenha input[type="password"] {
  background-color: white;
  border: 2px solid #ddd;
  transition: border-color 0.3s;
}

#formAlterarSenha input[type="password"]:focus {
  border-color: #25691b;
  outline: none;
  box-shadow: 0 0 5px rgba(37, 105, 27, 0.3);
}

/* Responsividade para relatórios e usuários */
@media (max-width: 768px) {
  .relatorios-menu {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .tabela-relatorio {
    font-size: 0.8rem;
  }

  .tabela-relatorio th,
  .tabela-relatorio td {
    padding: 8px 6px;
  }

  .resultados-relatorio {
    max-height: 300px;
  }

  .btn-pequeno {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  #formAlterarSenha {
    padding: 15px;
    margin-top: 15px;
  }
}
