/* Reset & Base */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
}

.container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background-color: #6a1b9a;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.sidebar .logo {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 40px;
}

.sidebar button {
  background: white;
  color: #6a1b9a;
  border: none;
  padding: 10px;
  margin-bottom: 10px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 5px;
  font-size: 15px;
}

.sidebar button:hover {
  background-color: #e1bee7;
}


.topbar {
  background-color: #eee;
  padding: 10px 20px;
  font-weight: bold;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#summarizeBtn {
  background-color: #6a1b9a;
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
}

#summarizeBtn:hover {
  background-color: #7e39aa;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Page Views */
.page {
  display: none;
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.page.active {
  display: block;
}

/* QnA Layout */
.chatbox {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#messages {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border: 1px solid #ccc;
  flex: 1;
}

.input-area {
  display: flex;
}

.input-area input {
  flex: 1;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px 0 0 5px;
  outline: none;
}

.input-area button {
  padding: 10px 20px;
  background-color: #6a1b9a;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 0 5px 5px 0;
}

/* Document Generator Layout */
.docgen-container {
  display: flex;
  height: calc(100vh - 100px);
}

.left-pane,
.right-pane {
  width: 50%;
  box-sizing: border-box;
  overflow-y: auto;
  background: white;
  border: 1px solid #ccc;
}

/* Left Pane (Image Preview & Arrows) */
.left-pane {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  height: 100%;
}

.carousel-controls button {
  background-color: #6a1b9a;
  color: white;
  border: none;
  padding: 6px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  height: 36px;
  width: 36px;
}


.carousel-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  height: 100%;
  max-height: 100%;
}


.carousel-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid #ccc;
}

/* Right Pane (Document Output) */
.right-pane {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.top-right-action {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

iframe#docPreview {
  flex: 1;
  border: none;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    padding: 10px;
  }

  .docgen-container {
    flex-direction: column;
  }

  .left-pane,
  .right-pane {
    width: 100%;
    height: auto;
  }

  .carousel-image {
    height: 300px;
  }

  .carousel-controls {
    flex-direction: column;
    gap: 10px;
  }
}

.message {
  max-width: 70%;
  padding: 12px 16px;
  margin: 10px 0;
  border-radius: 18px;
  line-height: 1.4;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
}


.bot-message {
  background-color: #f1f1f1;
  color: #333;
  align-self: flex-end;
  border-top-right-radius: 0;
  white-space: normal;
}

.bot-message p {
  margin: 6px 0;
  line-height: 1.8;
}

.bot-message ul,
.bot-message ol {
  margin: 4px 0;
  padding-left: 20px;
}

.bot-message li {
  margin-bottom: 3px;
}



.user-message {
  background-color: #6a1b9a;
  color: white;
  align-self: flex-start;
  border-top-left-radius: 0;
}

/* Optional: add emoji or small icon styling */
.message::after {
  content: "";
  display: table;
  clear: both;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;  /* was margin-left before */
  border: 3px solid #ccc;
  border-top: 3px solid #6a1b9a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}


@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#docPreview {
  flex: 1;
  width: 100%;
  height: 100%;
  resize: none;
  padding: 15px;
  font-size: 14px;
  font-family: monospace;
  border: 1px solid #ccc;
  background-color: #fafafa;
  box-sizing: border-box;
}

.docgen-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.docgen-actions button {
  padding: 8px 14px;
  font-size: 14px;
  background-color: #6a1b9a;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.docgen-actions button:hover {
  background-color: #7e39aa;
}


.left-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

#appName {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  width: 50%;
  box-sizing: border-box;
}

.button-like {
  padding: 8px 14px;
  background-color: #6a1b9a;
  color: white;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.file-count {
  font-size: 14px;
  color: #555;
  margin-left: 8px;
}

.button-like input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
  height: 100%;
  width: 100%;
}

/* Moves nav buttons below image */
.carousel-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

/* Hide navigation arrows initially */
.carousel-nav button {
  display: none;
}


/* Make image fill preview area better */

.carousel-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 90vh;
  border: 1px solid #ccc;
}

/* New Dropdown for File Selection */
.file-dropdown {
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 5px;
  border: 1px solid #aaa;
  background-color: white;
  color: #333;
  min-width: 180px;
}

/* Optional: Consistent height with buttons */
.file-dropdown:focus {
  outline: none;
  border-color: #6a1b9a;
}

#pdfCanvas {
  width: 100%;
  height: auto;
  max-height: 90vh;
  border: 1px solid #ccc;
  object-fit: contain;
}

/* Hide both image and pdf viewers by default */
#imageDisplay, #pdfCanvas {
  display: none;
}

/* Only the active one shows */
#imageDisplay.active {
  display: flex;
}

#pdfCanvas.active {
  display: block;
}

