:root {
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --accent-color: #8e44ad;
  --accent-hover: #9b59b6;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --border-color: #333333;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* App Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.sidebar-header h1 {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.new-chat-btn {
  padding: 12px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.new-chat-btn:hover {
  background-color: var(--accent-hover);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.conversation-item {
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conversation-item:hover {
  background-color: var(--bg-tertiary);
}

.conversation-item.active {
  background-color: var(--bg-tertiary);
  border-left: 3px solid var(--accent-color);
}

.conversation-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.conversation-item:hover .conversation-actions {
  opacity: 1;
}

.conversation-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.conversation-actions button:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-btn {
  padding: 10px;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.settings-btn:hover {
  background-color: var(--bg-tertiary);
}

.app-info {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 6px;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* API Key Container */
.api-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
}

.api-card {
  max-width: 500px;
  width: 100%;
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
  border: 1px solid var(--border-color);
}

.api-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.api-header i {
  color: var(--accent-color);
}

.api-input-group {
  position: relative;
  margin: 16px 0;
}

.api-input-group input {
  width: 100%;
  padding: 12px;
  padding-right: 40px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 16px;
}

.api-input-group button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.primary-btn {
  padding: 12px 24px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

.primary-btn:hover {
  background-color: var(--accent-hover);
}

.secondary-btn {
  padding: 8px 16px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.toggle-sidebar-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 4px;
}

.chat-title {
  margin-left: 16px;
  font-size: 16px;
  font-weight: 600;
  flex-grow: 1;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.icon-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Model Selection */
.model-selection {
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-selection select {
  padding: 8px 12px;
  border-radius: 6px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 14px;
}

.model-info {
  position: relative;
  display: inline-block;
  color: var(--text-secondary);
  cursor: pointer;
}

.model-info .tooltip {
  visibility: hidden;
  width: 200px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
}

.model-info:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* Messages */
.messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 90%;
  padding: 12px 16px;
  border-radius: 8px;
  position: relative;
  line-height: 1.5;
  font-size: 15px;
}

.message::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

.user-message {
  background-color: var(--accent-color);
  margin-left: auto;
  border-bottom-right-radius: 0;
}

.user-message::after {
  right: -8px;
  border-left-color: var(--accent-color);
  border-right: 0;
  bottom: 0;
}

.bot-message {
  background-color: var(--bg-tertiary);
  margin-right: auto;
  border-bottom-left-radius: 0;
}

.bot-message::after {
  left: -8px;
  border-right-color: var(--bg-tertiary);
  border-left: 0;
  bottom: 0;
}

.message-timestamp {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: right;
}

/* Message Content Styling */
.message h1,
.message h2,
.message h3,
.message h4,
.message h5,
.message h6 {
  color: var(--text-primary);
  margin: 16px 0 8px 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.message pre {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
}

.message code {
  font-family: "Fira Code", monospace;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}

.message pre code {
  background-color: transparent;
  padding: 0;
}

.message ul,
.message ol {
  margin: 12px 0;
  padding-left: 24px;
}

.message li {
  margin: 6px 0;
}

.message blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 12px;
  margin: 12px 0;
  color: var(--text-secondary);
}

.message p {
  margin: 8px 0;
}

.message table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.message th,
.message td {
  border: 1px solid var(--border-color);
  padding: 8px;
  text-align: left;
}

.message th {
  background-color: rgba(0, 0, 0, 0.2);
}

.message a {
  color: #3498db;
  text-decoration: none;
}

.message a:hover {
  text-decoration: underline;
}

.message img {
  max-width: 100%;
  border-radius: 4px;
  margin: 10px 0;
}

/* Status Messages */
.loading {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 10px;
  gap: 8px;
}

.loading .dot-typing {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  animation: typingAnimation 1.4s infinite;
  margin-right: 4px;
}

.loading .dot-typing:nth-child(2) {
  animation-delay: 0.2s;
}

.loading .dot-typing:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0% {
    transform: translateY(0px);
  }
  28% {
    transform: translateY(-5px);
  }
  44% {
    transform: translateY(0px);
  }
}

.error {
  color: var(--danger-color);
  padding: 10px;
  background-color: rgba(231, 76, 60, 0.1);
  border-left: 3px solid var(--danger-color);
  border-radius: 4px;
  margin: 10px 0;
}

/* Input Area */
.input-area {
  padding: 16px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.input-container {
  flex-grow: 1;
  position: relative;
}

.input-area textarea {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

.input-area textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.input-container .icon-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
}

.send-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-btn:hover {
  background-color: var(--accent-hover);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  overflow: auto;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--bg-secondary);
  margin: 5% auto;
  max-width: 600px;
  width: 90%;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 20px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Settings */
.settings-section {
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.setting-group {
  margin-bottom: 16px;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.setting-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
}

.setting-group input[type="number"] {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.theme-selector {
  display: flex;
  gap: 8px;
}

.theme-btn {
  padding: 8px 16px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn.active {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    z-index: 99;
    transform: translateX(-100%);
    height: 100%;
    /* Ensure it covers the full height */
    width: var(--sidebar-width); /* Keep original width for sliding */
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Adjust main content to take full width when sidebar is hidden */
  .main-content {
    width: 100%;
    /* Occupy full width when sidebar is hidden */
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
  }

  /* Ensure the toggle button is always visible on smaller screens */
  .chat-header .toggle-sidebar-btn {
    display: block; /* Ensure it's not hidden by any other rule */
  }
  .input-area {
    margin-bottom: 50px;
  }
}

/* Light Theme */
.light-theme {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaeaea;
  --text-primary: #333333;
  --text-secondary: #666666;
  --border-color: #dddddd;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Additional File Upload Styling */
.file-upload {
  display: none;
}

.attached-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.attached-file {
  background-color: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.attached-file .remove-file {
  color: var(--text-secondary);
  cursor: pointer;
}

.attached-file .remove-file:hover {
  color: var(--danger-color);
}

/* Message Actions */
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-actions button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  width: fit-content;
  margin-right: auto;
  border-bottom-left-radius: 0;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

/* Code Copy Button */
.copy-code-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
}

.message pre:hover .copy-code-btn {
  opacity: 1;
}

.copy-code-btn:hover {
  background-color: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}

/* Tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 5px;
  padding: 5px 10px;
  border-radius: 4px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

[data-tooltip]:hover:before {
  opacity: 1;
  visibility: visible;
}

/* File Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  margin: 16px 0;
  background-color: var(--bg-tertiary);
  transition: border-color 0.2s, background-color 0.2s;
}

.dropzone.active {
  border-color: var(--accent-color);
  background-color: rgba(142, 68, 173, 0.1);
}

.dropzone i {
  font-size: 32px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  margin: auto;
  text-align: center;
  max-width: 600px;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.suggestion-chip {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.suggestion-chip:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-color);
}

/* Markdown Images */
.message img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
}

/* Expandable Images */
.expandable-image {
  cursor: pointer;
  transition: transform 0.2s;
}

.expandable-image:hover {
  transform: scale(1.02);
}

.image-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  overflow: auto;
}

.image-modal-content {
  display: block;
  margin: 5% auto;
  max-width: 90%;
  max-height: 90%;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

/* Syntax Highlighting */
.hljs {
  background: transparent;
  padding: 0;
}

/* Mobile Responsive Adjustments */
@media (max-width: 576px) {
  /* General padding adjustments for smaller screens */
  .chat-header {
    padding: 12px 10px; /* Reduced padding */
  }

  .chat-title {
    font-size: 15px; /* Slightly smaller font */
  }

  .model-selection {
    padding: 10px; /* Reduced padding */
    flex-wrap: wrap; /* Allow model select and info to wrap */
    justify-content: center; /* Center items if they wrap */
  }

  .model-selection select {
    width: 100%; /* Make select full width on small screens */
    margin-bottom: 8px; /* Add space below select */
  }

  .messages {
    padding: 15px; /* Reduced padding */
    gap: 12px; /* Slightly reduced gap between messages */
  }

  .message {
    max-width: 95%; /* Give a bit more room */
    font-size: 14px; /* Slightly smaller font for messages */
  }

  .input-area {
    padding: 10px; /* Reduced padding */
    gap: 8px; /* Reduced gap */
  }

  .input-area textarea {
    font-size: 14px; /* Consistent font size */
    padding: 10px 35px 10px 10px; /* Adjust padding for smaller send button */
    min-height: 40px; /* Slightly smaller min-height */
  }

  .send-btn {
    width: 38px; /* Slightly smaller */
    height: 38px; /* Slightly smaller */
  }

  .input-container .icon-btn {
    right: 5px; /* Adjust icon button position */
    bottom: 5px; /* Adjust icon button position */
    padding: 5px; /* Smaller padding for icon button */
  }

  .modal-content {
    width: 100%;
    margin: 0;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .modal-header {
    padding: 12px 16px; /* Adjust modal header padding */
  }

  .modal-body {
    padding: 12px 16px; /* Adjust modal body padding */
    max-height: calc(
      100vh - 120px
    ); /* Adjusted calculation for full screen modal */
  }

  .modal-footer {
    padding: 12px 16px; /* Adjust modal footer padding */
  }

  .message-actions {
    flex-wrap: wrap;
    justify-content: center; /* Center actions if they wrap */
    gap: 6px; /* Reduced gap */
  }

  .suggestion-chips {
    display: none; /* Already hidden, good */
  }

  .api-card {
    padding: 24px; /* Reduce padding for API card on small screens */
  }

  .api-header h2 {
    font-size: 20px; /* Adjust header font size */
  }

  .api-input-group input {
    font-size: 14px; /* Adjust input font size */
    padding: 10px 35px 10px 10px; /* Adjust padding for eye button */
  }

  .primary-btn,
  .secondary-btn {
    font-size: 14px; /* Adjust button font size */
    padding: 10px 20px; /* Adjust button padding */
  }

  .scroll-bottom-btn {
    bottom: 70px; /* Adjust position to avoid input area */
    right: 15px; /* Adjust position */
    width: 36px; /* Smaller button */
    height: 36px; /* Smaller button */
  }

  .empty-state {
    padding: 20px 10px; /* Reduce padding */
  }

  .empty-state h2 {
    font-size: 20px; /* Smaller heading */
  }

  .empty-state p {
    font-size: 14px; /* Smaller paragraph text */
  }

  .toast {
    min-width: unset; /* Allow toast to shrink */
    max-width: 90%; /* Max width for toast */
    right: 10px; /* Adjust position */
    top: 10px; /* Adjust position */
    padding: 10px 12px; /* Adjust padding */
  }

  .toast-message {
    font-size: 13px; /* Smaller toast message font */
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-left: 4px solid var(--accent-color);
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 300px;
  animation: slideInRight 0.3s, fadeOut 0.5s 3s forwards;
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-icon {
  font-size: 20px;
}

.toast-message {
  font-size: 14px;
}

.toast-close {
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Profile Indicator */
.profile-indicator {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-right: 8px;
}

.user-indicator {
  background-color: var(--accent-color);
  color: white;
}

.bot-indicator {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Message with sender */
.message-with-sender {
  display: flex;
  align-items: flex-start;
  max-width: 100%;
}

.message-content {
  flex: 1;
}

/* System messages */
.system-message {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  font-style: italic;
  max-width: 80%;
  margin: 8px auto;
  text-align: center;
  font-size: 13px;
}

/* Print styles */
@media print {
  .sidebar,
  .chat-header,
  .input-area,
  .model-selection {
    display: none !important;
  }

  .app-container {
    display: block;
  }

  .main-content {
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .messages {
    overflow: visible;
    height: auto;
  }

  .message {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* Context Menu */
.context-menu {
  position: absolute;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  min-width: 180px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
}

.context-menu.show {
  display: block;
}

.context-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  transition: background-color 0.2s;
}

.context-menu-item:hover {
  background-color: var(--bg-tertiary);
}

.context-menu-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Scroll to bottom button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.scroll-bottom-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-bottom-btn:hover {
  background-color: var(--bg-tertiary);
}

/* Auto-resize textarea */
.input-area textarea {
  min-height: 45px;
  transition: height 0.2s;
}

/* User typing animation */
@keyframes userTyping {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

.user-typing {
  animation: userTyping 1.5s infinite;
}

/* Focus mode */
.focus-mode .sidebar {
  transform: translateX(-100%);
}

.focus-mode .main-content {
  margin-left: 0;
}

.focus-mode .chat-header {
  background-color: transparent;
  border-bottom: none;
}

/* RTL Support */
.rtl {
  direction: rtl;
}

.rtl .sidebar {
  right: 0;
  left: auto;
  border-right: none;
  border-left: 1px solid var(--border-color);
}

.rtl .message-with-sender {
  flex-direction: row-reverse;
}

.rtl .profile-indicator {
  margin-right: 0;
  margin-left: 8px;
}

.rtl .user-message {
  margin-left: 0;
  margin-right: auto;
  border-bottom-right-radius: 8px;
  border-bottom-left-radius: 0;
}

.rtl .bot-message {
  margin-right: 0;
  margin-left: auto;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 0;
}

.rtl .user-message::after {
  right: auto;
  left: -8px;
  border-left-color: transparent;
  border-right-color: var(--accent-color);
  border-left: 0;
  border-right: 8px solid;
}

.rtl .bot-message::after {
  left: auto;
  right: -8px;
  border-right-color: transparent;
  border-left-color: var(--bg-tertiary);
  border-right: 0;
  border-left: 8px solid;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus indicators */
button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* For Edge compatibility */
@supports (-ms-ime-align: auto) {
  .message pre {
    white-space: pre-wrap;
  }
}

/* For Safari compatibility */
@supports (-webkit-touch-callout: none) {
  .input-area textarea {
    font-size: 16px; /* Prevents zoom on Safari mobile */
  }
}
