* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  font-family: "Roboto", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #fff;
}

header {
  flex-shrink: 0;
}

.top-bar {
  width: 100%;
  height: 48px;
  background-color: #0a4a22;
}

.header-content {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 2rem 5%;
  color: white;
  background-image: linear-gradient(
    141deg,
    #194e1e 0%,
    #268731 70%,
    #40a11c 100%
  );
}

header h2 {
  font-weight: 800;
  font-size: 2.5rem;
  margin-top: -0.33rem;
}

header h3,
header h4 {
  font-weight: 100;
  font-size: 0.75rem;
}

.page-wrapper {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  flex-shrink: 0;
  display: none;
}

.sidebar h3 {
  font-weight: 700;
  font-size: 1.5rem;
  color: #343a40;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #28a745;
  display: none;
}

.main-content {
  flex-grow: 1;
  padding: 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center; 
  gap: 1rem;
}

label {
  font-size: 0.75rem;
  color: #afafaf;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border: 2px solid #28a745;
  border-radius: 8px;
  background-color: #fff;
  color: #333;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #218838;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
  outline: none;
}

button,
.submit-button {
  font-weight: bold;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background-color: #28a745;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

button:hover:enabled,
.submit-button:hover:enabled {
  background-color: #218838;
  opacity: 0.9;
}

button:disabled,
.submit-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1rem;
}

.column label {
  font-weight: 600;
  color: #1d1d1d;
  font-size: 1rem;
}

.sidebar .pergunta-container,
.sidebar .debug-items,
.sidebar .non-debug-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 1.5rem;
  border: 2px solid #28a745;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.sidebar .form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar .debug-items {
  background-color: #eefcf1;
}

.sidebar .non-debug-items {
  background-color: #fefefe;
}

.textarea-with-button {
  position: relative;
  display: flex;
  align-items: flex-end;
  margin-bottom: 1rem; 
  width: 90%;
}

.pergunta-textarea {
  flex-grow: 1; 
  min-height: 120px;
  padding-right: 80px; 
  box-sizing: border-box; 
  resize: vertical;
  font-size: 1.05rem;
}

.textarea-with-button button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 0.6rem 1.2rem; 
  background-color: #28a745; 
  color: white;
  border: none;
  border-radius: 8px; 
  cursor: pointer;
  z-index: 1; 
}

.textarea-with-button button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.submit-container {
  display: none;
}

.resposta-box,
#resposta-llm,
#documentos-utilizados,
.main-content .debug-items {
  width: 90%; 
  background-color: #fff;
  padding: 1.5rem 2rem;
  border: 2px solid #28a745;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  line-height: 1.6;
  font-size: 1.05rem;
}

#resposta-llm,
#documentos-utilizados {
  border: 1px dashed #28a745;
  background-color: #fafff0;
}
.main-content .debug-items {
  background-color: #f0f0f0;
  border-style: dashed;
}
.main-content .debug-items h5 {
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.resposta-box strong {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: block;
  color: #1d1d1d;
}

.resposta-box a,
#resposta-llm a,
#documentos-utilizados a {
  color: #007bff;
  text-decoration: none;
}
.resposta-box a:hover,
#resposta-llm a:hover,
#documentos-utilizados a:hover {
  text-decoration: underline;
}

.main-content h5 {
  color: #004d99;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.2em;
  width: 90%;
  text-align: left;
}

/* Responsividade */
@media (max-width: 992px) {
  .page-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #28a745;
    max-height: none;
    margin-bottom: 1.5rem;
  }

  .header-content {
    padding: 1.5rem 2rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .header-content h1 {
    margin-top: 0.5rem;
  }

  .main-content {
    padding: 1.5rem;
  }

  .textarea-with-button,
  .resposta-box,
  #resposta-llm,
  #documentos-utilizados,
  .main-content .debug-items,
  .main-content h5 {
    width: 95%;
  }

  .header-content {
    padding: 1.5rem 2rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .header-content h1 {
    margin-top: 0.5rem;
  }
}

@media (max-width: 576px) {
  .header-content {
    padding: 1rem 1.5rem;
  }
  header h2 {
    font-size: 2rem;
  }
  .sidebar {
    padding: 1rem;
  }
  .sidebar h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }
  .main-content {
    padding: 1rem;
  }
  
  .textarea-with-button,
  .resposta-box,
  #resposta-llm,
  #documentos-utilizados,
  .main-content .debug-items,
  .main-content h5 {
    width: 100%;
  }
}
