/* --- CSS Variables --- */
:root {
  --color-dark-bg: #222222;         /* Very dark gray */
  --color-darker-bg: #222222;       /* Slightly lighter dark gray */
  --color-sidebar: #181818;         /* Sidebar background */
  --color-text: #f2f6fa;            /* Near-white text */
  --color-text-sidebar: #dbe2e8;    /* Light gray text */
  --color-border: #3a3a3c00;          /* Medium gray border */
  --color-hover: #2c2c2e;           /* Hover effect */
  --color-input-bg: #363636;        /* Input background */
  --color-accent: #8e8e93;          /* Generic accent */
  --color-accent-user: #363636;     /* User message bubble background */
  /* Assistant messages now transparent */
  --color-accent-assistant: transparent;
}

/* --- Reset & Global Styles --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
    font-family:ui-sans-serif,-apple-system,system-ui,Segoe UI,Helvetica,Apple Color Emoji,Arial,sans-serif,Segoe UI Emoji,Segoe UI Symbol;
    background-color: var(--color-dark-bg);
  color: var(--color-text);
  height: 100vh;
  overflow: hidden;
  font-size: 1rem;
}

/* --- Login Container Styles --- */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  text-align: center;
}
.login-container h2 {
  font-size: 2rem;
  margin-bottom: 0.8em;
}
.login-container p {
  font-size: 1rem;
  margin-bottom: 0.8em;
}

/* --- Main App Container --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- Sidebar Styles --- */
.sidebar {
  width: 260px;
  color: var(--color-text-sidebar);
  background-color: var(--color-sidebar);
  padding: 0;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-size: .875rem;
}
.sidebar-header {
  position: sticky;
  top: 0;
  background-color: var(--color-sidebar);
  padding: 1rem;
  z-index: 10;
}

.sidebar-nav {
  flex: 1;
  padding: 0 1rem;
}
.new-chat-btn {
    font-size:.875rem;
  width: 100%;
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  margin-top: 0.8em;
}
.new-chat-btn:hover {
  background-color: var(--color-hover);
}
.plus-icon {
  margin-right: 0.5rem;
  font-weight: bold;
  font-size: 1.2rem;
}
.chat-list {
  list-style: none;
}
.chat-item {
  width: 100%;
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.75rem;
  margin-top: 0.8em;
  cursor: pointer;
}
.chat-item:hover,
.chat-item.active {
  background-color: var(--color-hover);
}
.chat-title {
}
.sidebar-footer {
  position: sticky;
  bottom: 0;
  background-color: var(--color-sidebar);
  padding: 1rem;
  z-index: 10;
  text-align: center;
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  position: relative;
  background-color: var(--color-darker-bg);
  overflow: hidden;
}

/* When no chat is selected */
.main-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.main-heading {
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 0.8em;
  color: var(--color-text);
}

/* --- Chat Messages Container --- */
.chat-messages {
  display: flex;
  flex-direction: column;
  height: calc(100% - 70px); /* Reserve space for input bar */
  padding-bottom: 16rem;
  overflow-y: scroll;
  padding: 1rem;
  /* Limit width to avoid overly wide messages and center them */
  max-width: 800px;
  margin: 0 auto;
  padding-top: 5rem;
  padding-bottom: 10rem;
}

/* --- Markdown Content Styling --- */

/* Paragraphs */
.chat-messages p {
  margin-bottom: 0.8em;
  line-height: 1.6;
}

/* Lists */
.chat-messages ul,
.chat-messages ol {
  margin-left: 1.2em;
  margin-bottom: 0.8em;
}
.chat-messages li {
  margin-bottom: 0.4em;
}

/* Code blocks */
.chat-messages pre {
  background-color: #000;
  color: #fff;
  padding: 0.8em;
  border-radius: 16px;
  overflow-x: auto;
  margin-bottom: 0.8em;
  font-size: .8rem;
}
.chat-messages code {
  color: #f2f2f2;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: inherit;
  font-size: .8rem;
}

/* Tables */
.chat-messages table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.8em;
}
.chat-messages th,
.chat-messages td {
  border: 1px solid #555;
  padding: 0.5em;
  text-align: left;
}
.chat-messages th {
  background-color: #2d2d2d;
}

.chat-messages img {
  max-width: 100%;
  height: auto;
  margin-bottom: 0.8em;
}

.chat-messages a {
  color: #007bff;
  text-decoration: none;
}

/* Blockquotes */
.chat-messages blockquote {
  border-left: 4px solid #555;
  padding-left: 1em;
  margin-left: 0;
  color: #ccc;
  margin-bottom: 0.8em;
}

/* --- Chat Bubble Styles --- */
.message {
  padding: 0.75rem 1rem;
  margin-bottom: 0.8em;
  border-radius: 16px;
  word-wrap: break-word;
  line-height: 1.4;
  max-width: 100%;
}
.message.user {
  background-color: var(--color-accent-user);
  align-self: flex-end;
  text-align: right;
  max-width: 75%;
  text-align: left;
}
.message.assistant {
  background-color: var(--color-accent-assistant); /* Transparent */
  align-self: flex-start;
  text-align: left;
}

/* --- Input Bar --- center items inside*/
.input-bar {
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  background-color: var(--color-dark-bg);
  padding: 1rem;
  border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 4rem;

}
.chat-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    max-width: 800px;
    border: none;
    border-radius: 16px;
    background-color: var(--color-input-bg);
    color: var(--color-text);
    outline: none;
    overflow: hidden;    /* Hide scrollbar */
    resize: none;        /* Prevent manual resizing */
    min-height: 40px;    /* Set a minimum height */
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }
  

/* --- Button Styles --- */
.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  cursor: pointer;
}
.btn.primary {
  background-color: var(--color-input-bg);
  color: var(--color-text);
}
.btn.secondary {
    background-color: transparent;
  color: var(--color-text);
}

/* --- Scrollbar Styling --- */
.sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: var(--color-sidebar);
}
.sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 16px;
}
