/* --- Global Styles --- */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', sans-serif;
  background: #121212;
  color: #e0e0e0;
  overflow: hidden;
  position: relative;
}
/* --- Chat View Layout --- */
#chat-view {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
}
/* --- Chat Header --- */
#chat-header {
  padding: 10px 15px;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}
#header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
#sidebar-toggle, #new-chat {
  cursor: pointer;
  font-size: 1.4em;
  color: #e0e0e0;
}
#sidebar-toggle:hover, #new-chat:hover {
  color: #00ff6a;
}
#header-center {
  flex-grow: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#header-center h2 {
  margin: 0;
  font-size: 1.2em;
  color: #00ff6a;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
#header-center h2:hover {
  cursor: pointer;
  text-decoration: underline dotted;
}
#header-right {
  display: flex;
  align-items: center;
}
#settings-toggle {
  cursor: pointer;
  font-size: 1.4em;
  color: #e0e0e0;
}
#settings-toggle:hover {
  color: #00ff6a;
}
/* --- Sidebar Styling (Left - Chats) --- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 300px;
  background: #1f1f1f;
  border-right: 1px solid #444;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 10px;
  box-sizing: border-box;
  z-index: 1010;
  display: flex;
  flex-direction: column;
}
#sidebar.open {
  transform: translateX(0);
}
#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}
#sidebar-header h3 {
  margin: 0;
}
#sidebar-close {
  cursor: pointer;
  font-size: 1.6em;
}
#chat-list {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 10px;
}
.chat-item {
  padding: 8px 12px;
  margin: 4px 0;
  background: #2a2a2a;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-item-title {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 10px;
}
.chat-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.chat-item:hover .chat-item-actions {
  opacity: 1;
}
.chat-item-actions span {
  cursor: pointer;
  font-size: 0.9em;
  color: #aaa;
}
.chat-item-actions span:hover {
  color: #fff;
}
.chat-item:hover {
  background: #3a3a3a;
}
.chat-item.active {
  background-color: #007bff;
  color: #fff;
  font-weight: bold;
}
.chat-item input.edit-chat-title {
  flex-grow: 1;
  padding: 4px 6px;
  margin: -4px 0;
  border: 1px solid #555;
  background-color: #444;
  color: #fff;
  font-size: inherit;
  font-family: inherit;
  border-radius: 3px;
  outline: none;
}
/* --- Settings Sidebar Styling (Right) --- */
#settings-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 300px;
  background: #1f1f1f;
  border-left: 1px solid #444;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  padding: 10px;
  box-sizing: border-box;
  z-index: 1005;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
#settings-sidebar.open {
  transform: translateX(0);
}
#settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}
#settings-header h3 {
  margin: 0;
  color: #00ff6a;
}
#settings-close {
  cursor: pointer;
  font-size: 1.6em;
}
.settings-section {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #333;
}
.settings-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}
.settings-section h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #bbb;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.settings-item {
  margin-bottom: 15px;
}
.settings-label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.95em;
  color: #ccc;
}
#settings-sidebar select,
#settings-sidebar button {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #444;
  background-color: #333;
  color: #e0e0e0;
  box-sizing: border-box;
  font-size: 0.95em;
}
#settings-sidebar button {
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s ease;
}
#settings-sidebar button:hover {
  background-color: #444;
}
#save-settings-sidebar {
  background-color: #00ff6a;
  color: #222;
}
#save-settings-sidebar:hover {
  background-color: #00c755;
}
#logout-btn-sidebar {
  background-color: #ff4d4d;
  color: white;
}
#logout-btn-sidebar:hover {
  background-color: #cc0000;
}
#model-info-container {
  background-color: #2a2a2a;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.9em;
  min-height: 80px;
  line-height: 1.4;
}
#model-info-container p {
  margin: 5px 0;
}
#model-info-container strong {
  color: #00ff6a;
}
.legal-links a {
  display: block;
  padding: 8px 0;
  color: #00aaff;
  text-decoration: none;
  font-size: 0.95em;
  transition: color 0.2s ease;
}
.legal-links a:hover {
  text-decoration: underline;
  color: #33ccff;
}
/* --- File Slots Area --- */
#file-slots-area {
  padding: 10px 15px;
  background: #1f1f1f;
  border-bottom: 1px solid #444;
  overflow-x: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
#file-slots-container {
  display: inline-flex;
  gap: 10px;
  padding-bottom: 10px;
}
.file-slot {
  width: 100px;
  height: 100px;
  border: 2px dashed #444;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #aaa;
  cursor: pointer;
  font-size: 0.8em;
  position: relative;
  overflow: hidden;
  background-color: #2a2a2a;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.file-slot.dragover {
  border-color: #00ff6a;
  background: rgba(0, 255, 106, 0.1);
}
.file-slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}
.file-slot .file-info {
  padding: 5px;
  word-break: break-all;
  font-size: 0.9em;
  line-height: 1.2;
}
.file-slot .file-info-icon {
  font-size: 2em;
  margin-bottom: 5px;
}
.file-slot .remove-file-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: rgba(255, 77, 77, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 1;
  transition: background-color 0.2s ease;
}
.file-slot .remove-file-btn:hover {
  background-color: rgba(204, 0, 0, 0.9);
}
.file-slot.has-file .remove-file-btn {
  display: block;
}
.file-slot.has-file .add-file-text {
  display: none;
}
/* --- Chat Container & Bubbles --- */
#chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: rgba(18, 18, 18, 0.8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-bubble {
  max-width: 75%;
  padding: 10px 15px;
  border-radius: 18px;
  line-height: 1.4;
  word-wrap: break-word;
}
.user-bubble {
  background: #007bff;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}
.ai-bubble {
  background: #3a3a3a;
  color: #e0e0e0;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}
.ai-bubble strong {
  color: #00ff6a;
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
}
.chat-bubble .timestamp {
  font-size: 0.75em;
  color: #aaa;
  display: block;
  margin-top: 5px;
  text-align: right;
}
.user-bubble .timestamp {
  color: #eee;
}
pre {
  background-color: #111;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  color: #e0e0e0;
}
code {
  font-family: 'Courier New', Courier, monospace;
  background-color: #2b2b2b;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: #e0e0e0;
}
pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}
/* --- Chat Input --- */
#chat-input-area {
  display: flex;
  padding: 10px 15px;
  background: #222;
  border-top: 1px solid #444;
  gap: 10px;
  flex-shrink: 0;
}
#chat-message {
  flex: 1;
  padding: 12px;
  min-height: 22px;
  resize: none;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid #444;
  background: #191919;
  color: #fff;
  line-height: 1.4;
  font-family: inherit;
  font-size: 1em;
  overflow-y: auto;
  max-height: none;
}
#send-btn {
  padding: 0 20px;
  height: 46px;
  align-self: flex-end;
  border-radius: 6px;
  background: #00ff6a;
  color: #222;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s ease;
}
#send-btn:active {
  background: #00c755;
}
#send-btn:disabled {
  background: #555;
  cursor: not-allowed;
}
/* --- Overlay --- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.overlay.active {
  opacity: 1;
  visibility: visible;
}
/* --- Media Queries --- */
@media (max-width: 768px) {
  #sidebar, #settings-sidebar {
    width: 280px;
  }
}
@media (max-width: 600px) {
  #chat-header {
    flex-direction: row;
    align-items: center;
  }
  #header-right {
    margin-top: 0;
  }
  #header-center {
    display: none;
  }
  #chat-container, #chat-input-area, #file-slots-area {
    padding: 8px;
  }
  .chat-bubble {
    max-width: 95%;
    font-size: 0.97em;
  }
  #chat-message {
    font-size: 1em;
    padding: 10px;
    max-height: 100px;
  }
  #send-btn {
    padding: 0 12px;
    height: 38px;
    font-size: 1em;
  }
  .file-slot {
    width: 80px;
    height: 80px;
    font-size: 0.7em;
  }
  .file-slot .remove-file-btn {
    width: 16px;
    height: 16px;
    font-size: 11px;
    line-height: 16px;
  }
}
