/* index.css */


#mongodb-ai-playground {
  height: 800px;           /* or whatever fixed height you want */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.content-wrapper {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 10px;
}

/* Error alert at the bottom */
#error-alert, .alert.alert-danger {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
}

/* Ensure error box is always visible above content */
#error-alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #dc3545;
  border-radius: 8px;
  font-weight: bold;
  display: none;
  padding: 10px;
  min-height: 40px;
  max-height: 90px;
  overflow-y: auto;
}

#error-alert[style*="display: block"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}


#mongodb-ai-playground > .sub-tabs-nav,
#mongodb-ai-playground > .steps-nav {
  flex: 0 0 auto;         /* tabs/nav bars keep their natural height */
}

#mongodb-ai-playground > div:not(.sub-tabs-nav):not(.steps-nav) {
  flex: 1 1 auto;         /* the content area fills the remaining height */
  overflow: auto;         /* scroll if content is too tall */
}

/* Basic container styling */
#chunking-section > div:first-child {
  /* Adjust as needed */
}

/* The container that holds document preview and chunks table */
#chunking-section > div:nth-child(2),
#embedding-section,
#rag-section {
  display: flex;
  gap: 3rem;
  /*height: 500px; /* Example fixed height */
  font-family: 'Euclid Circular A', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Steps navigation */
.steps-nav {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  list-style: none;
  padding: 0;
  /* margin: 20px 0 5px 0; */
  border-bottom: 3px solid #c1c7c6;

}

.step-button {
  background: none;
  border: none;
  color: #c1c7c6;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-transform: capitalize;
  padding: 0.5rem 1rem;
  cursor: pointer;
  outline: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px; /* Align with the container border */
}

.step-button:hover {
  color: #464c4f; /* Dark green hover color */
  background-color: transparent;
}

.active-step {
  color: #464c4f;
  border-bottom-color: #006400; /* Dark green bottom border for active tab */
}

.action-button {
  /* Base button styles */
  background: #F9FBFA;
  border: 1px solid #889397;
  color: #001E2B;
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  height: 36px;
  line-height: 34px;
  padding: 0 12px;
  text-transform: capitalize;
  cursor: pointer;
  transition: all 120ms ease;
  text-decoration: none;
  outline: none;
  font-family: "Euclid Circular A", "Helvetica Neue", Helvetica, Arial, sans-serif;
  border-radius: 6px !important;
}

.action-button:hover:not([disabled]),
.action-button:active:not([disabled]) {
  /* Hover / active state */
  color: #001E2B;
  background: #F9FBFA;
  box-shadow: 0 0 0 3px #E8EDEB;
  outline: 0;
}

/* Labels and inputs */
label {
  display: block;
  margin: 0.5rem 0 0.2rem;
  font-weight: bold;
}

input[type="range"],
select {
  width: 100%;
  max-width: 300px;
  margin-bottom: 0.5rem;
}

button {
    background: #00684A;
    border: 1px solid #00684A;
    color: #FFFFFF;
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    height: 36px;
    line-height: 34px;
    padding: 0 12px;
    margin-top: 8px;
    margin-right: 8px;
    transition: all 120ms ease;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease-in, color 0.2s ease-in;
    background-color: #077355;
}

button:hover {
  background-color: #066355;
  color: #FFF;
}


/* Textarea styling to look nicer */
textarea {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem;
  font-family: "Source Code Pro", Menlo, monospace;
  font-size: 14px;
  color: #333;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: #0b5d3a;
}

/* Error message */
/* .error-message not used for new error box, but keep for legacy */
.error-message {
  display: none;
}

/* Settings controls */
#settings-section {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

#settings-section label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 0;
  font-weight: 700;
  text-transform: uppercase;
  color: #889397;
  font-size: 9px;
  padding-right: 9px;
}

#settings-section select {
  border: 1px solid #E8EDEB;
  border-radius: 3px;
  font-weight: 700;
  font-size: 12px;
  margin-right: 10px;
  width: 95px;
  margin-bottom: 0.5rem;
}

#settings-section input[type="range"] {
  width: 150px;
  margin-bottom: 0.5rem;
}

/* Document preview box */
#document-view {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
  height: 450px;
  white-space: pre-wrap;
}

/* Chunks table container */
#chunks-table-container {
  flex: 1;
  overflow-y: auto;
}

#doc-list-container {
  flex: 1;
  overflow-y: auto;
  height: 500px;
  gap: 1rem;
  padding: 0rem;
}

/* The container for all chunk "cards" */
.chunk-card-container {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 500px;
  gap: 1rem;
  padding: 0rem;
}

/* Each chunk card */
.chunk-card {
  position: relative;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 1rem;
}

/* The tag showing page & chunk # */
.chunk-tag {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 9999px;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  text-transform: uppercase;
}

/* Chunk text area */
.chunk-text {
  margin-top: 1.5rem;
  white-space: pre-wrap;
}

/* Mongo doc list */
.doc-card-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0rem;
}

.doc-card {
  background: #fff;
  padding: 1rem;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-family: "Source Code Pro", Menlo, monospace;
  font-size: 12px;
}

.doc-key {
  font-weight: bold;
  color: #000;
  margin-right: 0.5rem;
}

.doc-value {
  color: #24292e;
}

.doc-value-id {
  color: #D9472B;
}

.doc-value-text {
  color: #5aa381;
}

.doc-value-embedding {
  color: #3A80EA;
  white-space: pre-wrap;
}

/* RAG doc cards (retrieved documents) */
.doc-tag {
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 9999px;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

/* Green text for final prompt's documents */
.green-doc-text {
  color: #0b5d3a; /* Same dark green used for buttons */
}

.sub-tabs-nav {
  margin-bottom: 1rem;
}

#final-prompt-container {
  flex: 1 1 auto;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  max-height: 300px;
  width: 100% !important; 
  background: #fff;
  white-space: pre-wrap;
}

#rag-results { min-width: 0; }


#final-prompt-container pre {
  white-space: pre-wrap;
  word-break: break-word;        /* break long tokens that were forcing the column wider */
  overflow-wrap: anywhere;
}

.loader {
  border: 5px solid #f3f3f3; /* Light grey */
  border-top: 5px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 2s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading {
  color: #888888;
}

.section-titles {
  font-weight: 700;
  text-transform: uppercase;
  color: #889397;
  font-size: 9px;
  padding-right: 9px;
  margin-top: 0px;
  margin-bottom: 1rem; 
}