/* HACK: this has wide application */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.assistant-layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
}

.session-list {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: calc(500px - 2.5rem);
  /* background: #f7f7faee; slightly transparent overlay */
  background-color: #ECEFF1;
  color: #1A2223;
  padding: 1rem 0.5rem;
  overflow-y: auto;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  z-index: 2001;
  margin: calc(1rem + 1px + 2.5rem + 1px + 1rem) auto 1rem 1rem;
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
}

.session-list h5 {
  margin-top: 0;
  margin-left: 3rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  /* color: #444; */
  color: #1C2526;
}

.session-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.session-item {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: background 0.2s;
}

/* .session-item:hover {
  background: #e3f2fd;
} */

.session-item.active-session,
.session-item.active-session:hover {
  /* background: #b3e5fc; */
  background: #B0BEC5;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0rem;
  width: 500px;
  margin: 0 auto;
  background-color: #fefefe;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  /* gap: 0.5rem; */
  text-align: left;
}

.chat-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 2.5rem;
  margin: 1rem 0.5rem 0.5rem 1rem;
  padding: 0;
  /* background-color: #f0f8f0; */
  background-color: #ECEFF1;
  /* border: 1px solid #d4e9d4; */
  border: 1px solid #B0BEC5;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chat-header-title {
  text-align: center;
  /* color: #2d5a2d; */
  color: #1A2223;
  font-weight: 500;
}

.nav-toggle {
  display: none; /* Hide the checkbox */
}

.nav-toggle-label {
  position: fixed;
  top: calc(1rem + 1px); /* +1px to clear the border of chat-header */
  left: calc(1rem + 1px);
  z-index: 2000;
  /* background: #b8e6b8; */
  /* color: #2d5a2d; */
  background: #B0BEC5;
  color: #1C2526;
  border-radius: calc(0.75rem - 1px); /* -1px to fit inside the radius of chat-header */
  cursor: pointer;
  font-size: 1.5rem;
  height: 2.5rem; /* same height as chat-header */
  width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  font-family: system-ui, sans-serif; /* Better font for hamburger icon */
  user-select: none; /* Prevent text selection */
}

/* Hide navigation by default */
.nav-toggle:not(:checked) ~ .session-list {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Show navigation when checkbox is checked */
.nav-toggle:checked ~ .session-list {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Move humburger right */
.nav-toggle:checked ~ .nav-toggle-label
{
  left: calc(500px - (2.5rem + 1px + 0.5rem)); /* I wish I understood this! */
}

.chat-history {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 0rem;
  margin: 0.5rem 0.5rem 0.5rem 1rem;
  background-color: #fafafa;
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  scroll-behavior: smooth; /* Enable smooth scrolling */
}

.chat-message {
  display:block;
  width: fit-content;
  max-width: 90%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: calc(0.75rem - 1px); /* -1px to fit inside the radius of chat-header */
  word-wrap: break-word;
}

.user-message {
  /* background-color: #d8eafd; */
  background-color: #FFD1D1;
  /* color: #003366; */
  color: #2B0F0F;
  align-self: flex-end;
  margin-left: auto;
  text-align: right;
}

.assistant-message {
  background-color: #D6E4FF;
  /* color: #4a1c2f; */
  color: #17233B;
  align-self: flex-start;
  margin-right: auto;
  text-align: left;
}

form {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

input.form-control, textarea.form-control {
  padding: 0.75rem;
  font-size: 1rem;
  box-sizing: border-box;
  resize: vertical;
  min-height: 6rem;
  margin: 0.5rem 0.5rem 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

button.btn {
  /* background-color: #a0d8ef;
  color: #003366; */
  background-color: #FF9999;
  color: #2E0F0F;
  /* background-color: #B0BEC5;
  color:#1C2526; */
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin: 0.5rem 0.5rem 1rem 1rem;
}

/* button.btn:hover {
  background-color: #90cde0;
} */

.content-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 0rem;
  margin: 1rem 1rem 1rem 0.5rem;
  /* background-color: #fafafa; */
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

@media (max-width: 600px) {
  .chat-container {
    padding: 0.5rem;
  }

  .chat-message {
    font-size: 0.95rem;
  }

  input.form-control,
  button.btn {
    font-size: 0.95rem;
  }

  .session-list {
    width: 80vw;
    min-width: 180px;
    max-width: 95vw;
  }
}