/* Reset básico e fontes */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100vh;
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background-color: #f5f3f9; /* Fundo roxo claro da página de login */
  color: #333;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

/* Header Principal */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  padding: 10px 30px;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header-content {
  display: flex;
  align-items: center;
}

.header-logo {
  width: 80px; /* Tamanho ajustado para o header */
  height: auto;
  margin-right: 20px;
}

.main-title {
  font-size: 24px;
  color: #4c2c92; /* Roxo escuro do login */
  font-weight: 600;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  color: #4c2c92;
  font-weight: 500;
}

#userName {
  margin-right: 20px;
}

.button-logout {
  background-color: transparent;
  color: #4c2c92;
  border: 1px solid #4c2c92;
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  transition: all 0.3s;
}

.button-logout i {
  margin-right: 8px;
}

.button-logout:hover {
  background-color: #4c2c92;
  color: #fff;
}

/* Container Principal */
.main-container {
  display: flex;
  flex: 1;
  padding: 20px;
  min-height: 0; /* Correção para overflow em flexbox */
}

/* Sidebar (Coluna da Esquerda) */
.sidebar {
  width: 280px;
  background-color: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
  margin-right: 20px;
}

.filter-section h3 {
  margin-top: 0;
  font-size: 1.2em;
  color: #4c2c92;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 25px;
}

/* Grupos de Formulário */
.form-group,
.form-group-checkbox {
  margin-bottom: 20px;
}

.form-group label,
.form-group-checkbox label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 14px;
  background-color: #f9fafb;
}

.form-group input[type="text"]::placeholder {
  color: #aaa;
}

.form-group input[type="text"]:focus {
  border-color: #4c2c92;
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(76, 44, 146, 0.15);
}

.form-group-checkbox {
  display: flex;
  align-items: center;
}

.form-group-checkbox input[type="checkbox"] {
  margin-right: 10px;
  accent-color: #4c2c92; /* Cor do checkbox */
}

/* Conteúdo Principal (Coluna da Direita) */
.content {
  flex-grow: 1;
  background-color: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
  display: flex; /* Adicionado para usar flexbox */
  flex-direction: column; /* Adicionado para empilhar itens verticalmente */
  min-height: 0; /* Adicionado para evitar overflow em flexbox */
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.content h2 {
  margin: 0;
  font-size: 1.8em;
  color: #4c2c92;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-controls label {
  font-size: 13px;
  color: #666;
  margin-right: 5px;
}

.sort-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
  background-color: #f9fafb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  transition: all 0.2s;
}

.sort-btn:hover {
  background-color: #f0f0f0;
  border-color: #ccc;
}

.sort-btn.active {
  background-color: #4c2c92;
  color: white;
  border-color: #4c2c92;
}

.sort-btn i {
  font-size: 12px;
}

/* Lista de Relatórios */
.report-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1; /* Adicionado para preencher o espaço disponível */
  overflow-y: auto; /* Adicionado para permitir rolagem apenas na lista */
  overflow-x: hidden; /* Adicionado para esconder o scroll horizontal */
  min-height: 0; /* Adicionado para evitar overflow em flexbox */
}

.report-list li {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  margin-bottom: 5px; /* Espaço entre os itens */
}

.report-list li:hover {
  background-color: #f5f3f9;
  transform: translateX(5px);
}

.report-list li .report-id {
  font-size: 0.9em;
  color: #4c2c92;
  margin-right: 10px;
  font-weight: bold;
  min-width: 50px;
}

.report-list li .report-name {
  flex-grow: 1;
  color: #333;
  font-weight: 500;
}

/* Badge de formato (PDF/Excel) */
.format-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 10px;
  margin-right: 10px;
}

.format-badge.pdf {
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.format-badge.excel {
  background-color: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* --- Estilos do Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 550px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background-color: #4c2c92;
  color: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #fff;
  opacity: 0.8;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 25px;
  max-height: 60vh;
  overflow-y: auto;
  background-color: #f9fafb;
}

.modal-body .form-group {
  margin-bottom: 20px;
}

.modal-body .form-group label {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.modal-body .form-group input,
.modal-body .form-group select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 15px;
  background-color: #fff;
}

.modal-body .form-group input::placeholder {
  color: #aaa;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
  border-color: #4c2c92;
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(76, 44, 146, 0.2);
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
  background-color: #fff;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.button-primary,
.button-secondary {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  transition: all 0.3s;
}

.button-primary {
  background-color: #25b34b; /* Verde do botão de login */
  color: white;
  margin-left: 10px;
}

.button-primary:hover {
  background-color: #21a244;
  transform: translateY(-2px);
}

.button-primary.loading {
  position: relative;
  color: transparent;
  cursor: wait;
}

.button-primary.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.button-secondary {
  background-color: #f0f0f0;
  color: #4c2c92;
  border-color: #e0e0e0;
}

.button-secondary:hover {
  background-color: #e0e0e0;
  border-color: #ccc;
}

/* --- Estilos do Login (Novo Design) --- */
.login-page {
  background-color: #dfe6ed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-page .login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  padding: 40px 50px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 80px;
  height: auto;
  margin-bottom: 20px;
}

.login-title {
  color: #25b34b;
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.login-subtitle {
  color: #666;
  font-size: 14px;
  margin: 0;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.login-form .form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #25b34b;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 15px;
  background-color: #f0faf3;
  color: #333;
  transition: all 0.3s ease;
}

.login-form .form-group input::placeholder {
  color: #888;
}

.login-form .form-group input:focus {
  outline: none;
  border-color: #1e9a3f;
  background-color: #e8f7ec;
  box-shadow: 0 0 0 3px rgba(37, 179, 75, 0.15);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 45px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  color: #25b34b;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background-color: #25b34b;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.btn-login:hover {
  background-color: #1e9a3f;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 179, 75, 0.3);
}

.btn-login:disabled {
  background-color: #8dd9a0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.login-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center;
}

.login-footer p {
  color: #888;
  font-size: 12px;
  margin: 0;
}

.login-footer a {
  color: #25b34b;
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.error-message {
  color: #e74c3c;
  background-color: #fdf2f2;
  border: 1px solid #f5c6c6;
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
  text-align: center;
  display: none;
}

/* --- Estilos para o Select Dropdown no Modal --- */
.modal-body .form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234c2c92%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13%205.1L147.2%20202.7%2018.5%2074.5a17.6%2017.6%200%200%200-24.7%2024.9l130.6%20129.8c6.8%206.7%2017.7%206.7%2024.5%200l130.6-129.8a17.6%2017.6%200%200%200-11.7-29.4z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 15px top 50%;
  background-size: 12px;
}

/* --- Responsividade Mobile --- */
@media (max-width: 768px) {
  /* Login Mobile */
  .login-page .login-container {
    padding: 15px;
  }

  .login-card {
    padding: 30px 25px;
    border-radius: 10px;
  }

  .login-logo {
    width: 70px;
    margin-bottom: 15px;
  }

  .login-title {
    font-size: 20px;
  }

  .login-subtitle {
    font-size: 13px;
  }

  .login-form .form-group input {
    padding: 12px 14px;
    font-size: 16px; /* Previne zoom no iOS */
  }

  .btn-login {
    padding: 14px;
    font-size: 16px;
  }

  .login-footer {
    margin-top: 20px;
    padding-top: 15px;
  }

  /* Header Mobile */
  .main-header {
    padding: 10px 15px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-logo {
    width: 60px;
    margin-right: 10px;
  }

  .main-title {
    font-size: 18px;
  }

  #userName {
    display: none;
  }

  .button-logout {
    padding: 6px 12px;
    font-size: 13px;
  }

  .button-logout i {
    margin-right: 5px;
  }

  /* Container Mobile */
  .main-container {
    flex-direction: column;
    padding: 10px;
  }

  .sidebar {
    width: 100%;
    margin-right: 0;
    margin-bottom: 15px;
    padding: 15px;
  }

  .content {
    padding: 15px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .content h2 {
    font-size: 1.4em;
  }

  .sort-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .sort-controls label {
    width: 100%;
    margin-bottom: 5px;
  }

  .sort-btn {
    flex: 1;
    justify-content: center;
    padding: 10px;
  }

  /* Lista de Relatórios Mobile */
  .report-list li {
    padding: 12px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .report-list li .report-id {
    font-size: 0.85em;
    min-width: 45px;
  }

  .report-list li .report-name {
    font-size: 0.9em;
  }

  .format-badge {
    margin-left: auto;
    margin-right: 0;
  }

  /* Modal Mobile */
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    padding: 12px 15px;
  }

  .modal-header h3 {
    font-size: 1.1em;
  }

  .modal-body {
    padding: 15px;
    max-height: 50vh;
  }

  .modal-body .form-group input,
  .modal-body .form-group select {
    padding: 12px;
    font-size: 16px; /* Previne zoom no iOS */
  }

  .modal-footer {
    padding: 15px;
    flex-direction: column;
    gap: 10px;
  }

  .button-primary,
  .button-secondary {
    width: 100%;
    margin-left: 0;
    padding: 14px;
  }

  .button-primary {
    order: -1; /* Botão principal primeiro */
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 25px 20px;
  }

  .login-logo {
    width: 60px;
  }

  .login-title {
    font-size: 18px;
  }

  .login-form .form-group {
    margin-bottom: 15px;
  }

  .report-list li {
    padding: 10px 8px;
  }

  .report-list li .report-name {
    width: 100%;
    order: 1;
    margin-top: 5px;
  }
}
