:root {
  --sidebar-bg: #050509;
  --sidebar-text: #ffffff;
  --sidebar-hover: #1a1a20;
  --accent-color: #8b5cf6;
  /* Purple */
  --accent-hover: #7c3aed;
  --main-bg: #f3f4f6;
  --card-bg: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  /* Green */
  --success-bg: #d1fae5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  height: 100vh;
  overflow: hidden;
  color: var(--text-primary);
}

#app-container {
  display: flex;
  height: 100%;
  width: 100%;
}

/* SIDEBAR */
#sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1f1f23;
}

.sidebar-header {
  padding: 20px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: transparent;
  margin: 0px;
  background-image: linear-gradient(90deg, rgb(99, 102, 241), rgb(168, 85, 247));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

.new-chat-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(90deg, rgb(79, 70, 229), rgb(124, 58, 237));
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.new-chat-btn:hover {
  opacity: 0.9;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.history-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  color: #d1d5db;
  font-size: 14px;
  transition: background 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.delete-history-btn {
  opacity: 0;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 12px;
}

.delete-history-btn:hover {
  color: #ef4444;
  background-color: rgba(255, 255, 255, 0.1);
}

.history-item:hover .delete-history-btn {
  opacity: 1;
}

.history-item:hover {
  background-color: var(--sidebar-hover);
  color: white;
}



/* MAIN CONTENT */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--main-bg);
  position: relative;
}

/* HEADER */
/* HEADER */
#top-bar {
  height: 60px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  color: rgb(51, 51, 51);
}

/* HEADER ACTIONS */
.model-selector-container {
  position: relative;
}

.model-menu-btn {
  background-color: #f3f4f6;
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  /* Pill shape */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.2s;
}

.model-menu-btn:hover {
  background-color: #e5e7eb;
}

.arrow-icon {
  font-size: 10px;
  color: var(--text-secondary);
}

/* SETTINGS DROPDOWN */
.settings-dropdown {
  position: absolute;
  top: 120%;
  left: 0;
  width: 300px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  padding: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: rgb(51, 51, 51);
}

.settings-dropdown.hidden {
  display: none;
}

/* WEB SEARCH TOGGLE */
.web-search-btn {
  padding: 8px 16px;
  border-radius: 20px;
  /* Pill shape */
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #f3f4f6;
  color: var(--text-secondary);
}

.web-search-btn.active {
  background-color: #10b981;
  /* Green */
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

/* CLEAR HISTORY BUTTON */
.clear-history-btn {
  padding: 8px 16px;
  border-radius: 20px;
  /* Pill shape */
  border: 1px solid #ffe4e6;
  background-color: #fff1f2;
  /* Light Red */
  color: #f43f5e;
  /* Red Text */
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-history-btn:hover {
  background-color: #ffe4e6;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* CONTENT WRAPPER (Settings + Chat) */
.content-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.settings-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.radio-item:hover {
  background-color: #f9fafb;
}

.radio-item.active {
  background: rgb(230, 255, 242);
  color: rgb(0, 170, 102);
  font-weight: 600;
  border-color: transparent;
}

.radio-item.active::after {
  content: "✓";
  font-weight: bold;
}

/* Hide the old check-icon span since we use ::after now */
.check-icon {
  display: none;
}

/* SLIDER */
.slider-container {
  padding: 0 4px;
}

.context-slider {
  width: 100%;
  margin-bottom: 8px;
  accent-color: var(--text-primary);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

/* CHAT AREA */
#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  line-height: 1.6;
}

.message.user {
  background-color: #f3f4f6;
  /* Slightly darker than white for user */
}

.message.assistant {
  background-color: white;
}



.message-content {
  flex: 1;
  font-size: 15px;
}

/* INPUT AREA */
#input-area {
  padding: 20px;
  background: transparent;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
}

.file-chip {
  background: white;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.remove-file {
  cursor: pointer;
  color: #ef4444;
  font-weight: bold;
}

.input-wrapper {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 12px;
  /* Space between textarea and buttons */
  align-items: flex-end;
}

#user-input {
  flex: 1;
  border: none;
  resize: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  min-height: 24px;
  max-height: 200px;
  padding: 4px 0;
}

.input-actions-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.action-btn {
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background-color: #e5e7eb;
  color: var(--text-primary);
}

.send-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
  border: none;
  border-radius: 10px;
  /* Slightly more rounded */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  font-size: 16px;
}

.send-btn:hover {
  opacity: 0.9;
}

.send-btn:active {
  transform: scale(0.95);
}

/* EMOJI PICKER POSITION */
.emoji-picker {
  bottom: 80px;
  /* Adjusted for new layout */
  right: 20px;
}

.emoji-picker.hidden {
  display: none;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-item {
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  text-align: center;
}

.emoji-item:hover {
  background-color: #f3f4f6;
}

/* WEB SEARCH STATUS */
.web-search-status {
  text-align: center;
  background: var(--success-bg);
  padding: 8px;
  border-radius: 4px;
  margin: 10px 0;
  font-weight: 600;
  letter-spacing: 0.05em;
}