body {
  background-color: #1e1e1e;
  color: #f3f3f3;
  font-family: "Segoe UI", system-ui, sans-serif;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background-color: #121212;
  padding: 1em;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #333;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-bottom: 1em;
}

.header-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: #f3f3f3;
}

.new-chat-btn {
  background-color: transparent;
  border: 1px solid #444;
  color: white;
  font-size: 1rem;
  padding: 0.6em;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.new-chat-btn:hover {
  background-color: #2f2f2f;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  overflow-y: auto;
  flex-grow: 1;
}

/* --- Chat Entry Wrapper --- */
.chat-title-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.chat-title-wrapper:hover {
  background-color: #2a2a2a;
}

/* --- Chat Button --- */
.chat-button {
  flex: 1;
  padding: 0.6em 0.8em;
  background: none;
  border: none;
  color: #eee;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-button:hover {
  background: none;
}

/* --- Three Dots Menu Button --- */
.menu-btn {
  color: #aaa;
  cursor: pointer;
  padding: 0.4em 0.6em;
  font-size: 1.2rem;
  user-select: none;
  transition: color 0.2s ease;
}

.menu-btn:hover {
  color: white;
}

/* --- Menu Dropdown --- */
.chat-menu {
  position: absolute;
  right: 0.5em;
  top: 2.5em;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease-in-out;
}

.chat-menu-item {
  padding: 0.5em 1em;
  cursor: pointer;
  font-size: 0.9rem;
  color: #eee;
  white-space: nowrap;
}

.chat-menu-item:hover {
  background: #444;
}

.chat-menu-item.delete {
  color: #ff6b6b;
}

.chat-menu-item.delete:hover {
  background: #442222;
}

/* --- Rename Input --- */
.chat-title-input {
  width: 100%;
  padding: 0.6em 1em;
  background-color: #2f2f2f;
  border: none;
  color: white;
  font-size: 1rem;
  border-radius: 6px;
  font-family: inherit;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 1em;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  background-color: #1b1b1b;
}

.exchange {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.bubble {
  border-radius: 12px;
  padding: 1em;
  white-space: pre-wrap;
  line-height: 1.6;
  max-width: 85%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in-out;
}

.user {
  align-self: flex-end;
  background-color: #2f2f2f;
  color: #ffffff;
}

.bot {
  align-self: flex-start;
  background-color: #3c3c3c;
  color: #ffffff;
}

.input-container {
  padding: 1em;
  background-color: #1e1e1e;
  border-top: 1px solid #333;
  box-shadow: 0 -10px 15px rgba(0, 0, 0, 0.5);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  background-color: #2f2f2f;
  border-radius: 999px;
  padding: 0.75em 1.2em;
  max-width: 900px;
  margin: 0 auto;
}

textarea {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: white;
  font-size: 16px;
  width: 100%;
  font-family: inherit;
  overflow: hidden;
  min-height: 24px;
  line-height: 1.4;
}

#sendArrow {
  background-color: white;
  color: black; /* arrow colour */
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.6em;
  line-height: 1;
  padding-bottom: 2px;
  transition: background-color 0.2s ease;
}

#sendArrow:hover {
  background-color: #e5e5e5;
}

/* cancel mode – black circle with white square */
/* force cancel state to render as black circle with white square */
#sendArrow.cancel {
  background-color: black !important;
  border-radius: 50%;
  position: relative;
  color: transparent !important;
  font-size: 0 !important;
}

#sendArrow.cancel::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  background: white;
  transform: translate(-50%, -50%);
  display: block;
}

#sendArrow.cancel:hover {
  background-color: #e5e5e5; /* keep hover the same */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.footer-warning {
  text-align: center;
  color: #b0b0b0;
  font-size: 0.75rem;
  padding: 0.75em 0;
  background-color: #1e1e1e;
  border-top: 1px solid #333;
}

/* ============================== */
/* Copilot-style ASK / AGENT menu */
/* ============================== */

/* The visible button ("Ask ▼" or "Agent ▼") */
#modeButton {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid #555;
  background: #1f1f1f;
  color: #eee;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#modeButton:hover {
  background: #2a2a2a;
  border-color: #777;
}

/* The dropdown menu */
.mode-menu {
  position: absolute;
  bottom: 38px; /* appears above the button */
  left: 0;
  width: 120px;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
  animation: fadeIn 0.12s ease-out;
}

/* Hidden by default */
.mode-menu.hidden {
  display: none;
}

/* Items inside dropdown */
.mode-option {
  padding: 8px 12px;
  font-size: 13px;
  color: #eee;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.mode-option:hover {
  background: #2d2d2d;
}

/* The currently selected option */
.mode-option.active {
  background: #3a3a3a;
  font-weight: 600;
}

/* ========================================= */
/* Footer row: Ask toggle + warning centered */
/* ========================================= */

.footer-footer-row {
  display: flex;
  align-items: center;
  justify-content: center;   /* keeps warning centered */
  padding: 0.75em 0;
  background-color: #1e1e1e;
  border-top: 1px solid #333;
  position: relative;        /* lets the Ask toggle sit on the left */
}

/* Ask toggle sits LEFT, aligned under 'Ask' in input */
#modeToggleFooter {
  position: absolute;
  left: calc(50% - 450px + 48px); 
  /*  
    50% - 450px = left edge of input-wrapper
    +48px = exact visual offset where the placeholder text begins
  */
  bottom: 8px;
}

.footer-warning-text {
  color: #b0b0b0;
  font-size: 0.75rem;
  text-align: center;
}

/* Ask / Agent button styling */
#modeToggleFooter .mode-btn {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid #555;
  background: #1f1f1f;
  color: #eee;
  cursor: pointer;
}

/* Dropdown menu under the Ask button */
#modeToggleFooter .mode-menu {
  position: absolute;
  bottom: 30px;
  left: 0;
  width: 88px;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 0;
  z-index: 400;
}

#modeToggleFooter .mode-menu.hidden {
  display: none;
}

#modeToggleFooter .mode-option {
  padding: 8px 16px;
  font-size: 13px;
  color: #eee;
  cursor: pointer;
}

#modeToggleFooter .mode-option:hover {
  background: #2d2d2d;
}

#modeToggleFooter .mode-option.active {
  background: #3a3a3a;
  font-weight: 600;
}

/* ===================================================== */
/* MULTI-LEVEL DROPDOWN: Ask, Agents → Base/Research/Debug */
/* ===================================================== */

/* Header row inside the dropdown */
.mode-option.group-header {
  font-size: 12px;
  color: #999;
  padding: 6px 12px;
  cursor: default;
  background: transparent;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Disable hover highlight for header */
.mode-option.group-header:hover {
  background: transparent;
}

/* Sub-options under "Agents" */
.sub-option {
  padding: 6px 20px;   /* indented to the right */
  font-size: 13px;
  color: #eee;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

/* Hover highlight for sub-options */
.sub-option:hover {
  background: #2d2d2d;
}

/* Active selected agent */
.sub-option.active {
  background: #3a3a3a;
  font-weight: 600;
}

/* ====================================================== */
/* NESTED SUBMENU (Agent ▶ Base/Research/Debug)           */
/* ====================================================== */

.mode-option.has-submenu {
  position: relative;
  padding-right: 20px;      /* spacing for arrow */
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
}

/* Arrow for Agent submenu */
.submenu-arrow {
  font-size: 11px;
  color: #bbb;
  margin-left: 3px !important;
}

/* The submenu container */
.mode-option.has-submenu .submenu {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 100%; /* width of main menu */
  width: 88px;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  z-index: 500;
}

/* Show submenu on hover */
.mode-option.has-submenu:hover .submenu {
  display: block;
}

/* Styling for sub-options */
.sub-option {
  padding: 8px 12px;
  font-size: 13px;
  color: #eee;
  cursor: pointer;
}

.sub-option:hover {
  background: #2d2d2d;
}

.sub-option.active {
  background: #3a3a3a;
  font-weight: 600;
}
