/* Chat Header Styles */
.chat-header {
  background: #f9f9f9;
  padding: 16px;
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  height: 64px; /* Match the height of sidebar-header */
  align-items: center;
}

.chat-header h2 {
  margin: 0;
  color: #333;
}

/* Sidebar toggle button in header - only shows when sidebar is closed */
.sidebar-toggle-button {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background-color: transparent;
  color: #666;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  margin-right: auto;
  margin-left: 16px;
}

.sidebar-toggle-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #333;
}

.sidebar-toggle-button:active {
  background-color: rgba(0, 0, 0, 0.1);
}

/* New Chat button in header - only shows when sidebar is collapsed */
.header-new-chat-button {
  display: flex;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background-color: transparent;
  color: #666;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 12px;
  position: relative;
}

.header-new-chat-button:disabled {
  background-color: transparent;
  color: #ccc;
  cursor: not-allowed;
}

.sidebar-closed .header-new-chat-button {
  display: flex;
  margin-right: auto;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background-color: transparent;
  color: #666;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 12px;
  position: relative;
}

.header-new-chat-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #333;
}

.header-new-chat-button:active {
  background-color: rgba(0, 0, 0, 0.1);
}

.header-new-chat-button .plus-icon {
  font-weight: normal;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Model selector in header */
.chat-header .custom-dropdown-button {
  margin-left: 10px;
}

.model-selector {
  display: inline-block;
  margin-left: 10px;
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: none;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.model-selector:hover {
  background-color: #f0f0f0;
  color: #333;
}

.model-selector:focus {
  outline: none;
  background-color: #f0f0f0;
  color: #333;
}

/* User info section */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding-left: 16px;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.upload-doc-button,
.logout-button,
.share-button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.upload-doc-button {
  background: none;
  color: #666;
}

.upload-doc-button:hover {
  background-color: #f0f0f0;
  color: #333;
}

.share-button {
  background: none;
  color: #666;
}

.share-button:hover {
  background-color: #f0f0f0;
  color: #333;
}

.share-button:disabled {
  background: none;
  color: #ccc;
  cursor: not-allowed;
}

.logout-button {
  background: none;
  color: #666;
}

.logout-button:hover {
  background-color: #f0f0f0;
  color: #333;
}

.manage-documents-button {
  background: none;
  color: #666;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.manage-documents-button:hover {
  background-color: #f0f0f0;
  color: #333;
  text-decoration: none;
}

/* Upload status in header */
.upload-status {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  margin-left: 10px;
}

.upload-status.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.upload-status.partial {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.upload-status.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
} 
/* Main Chat Container Styles */
.chat-container-with-sidebar {
  display: flex;
  width: 100%;
  height: calc(100vh - 60px); /* navbar is 60px high */
  overflow: hidden;
  position: relative;
}

/* CSS variables for sidebar dimensions */
:root {
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 40px;
  --mobile-sidebar-width: 280px;
  --navbar-height: 60px;
  --navbar-height-mobile: 56px;
  --navbar-height-small: 52px;
}

.chat-main {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: -1;
  transition: margin-left 0.3s ease;
}

.sidebar-open .chat-main {
  margin-left: var(--sidebar-width);
}

.sidebar-closed .chat-main {
  margin-left: var(--sidebar-collapsed-width);
}

.chat-container {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Chat disclaimer */
.chat-disclaimer {
  text-align: center;
  font-size: 0.8em;
  color: #888;
  padding: 10px;
  margin: 0;
  background-color: #f9f9f9;
}

/* Error and success messages */
.error-message {
  color: #d9534f;
  background-color: #f9eaea;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 14px;
}

.success-message {
  color: #3c763d;
  background-color: #dff0d8;
  border: 1px solid #d6e9c6;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 14px;
}

/* Empty state styles */
.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #888;
  font-style: italic;
}

.empty-state.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888;
  text-align: center;
  padding: 2rem;
  background-color: #f9f9f9;
  border-radius: 10px;
  margin: 2rem;
}

.empty-state.welcome h3 {
  margin-bottom: 1rem;
  color: #333;
}

.empty-state.welcome p {
  margin-bottom: 2rem;
  max-width: 400px;
}

/* Loading state */
.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #888;
  font-style: italic;
}

/* Drag and drop styles */
.chat-container.drag-active {
  background-color: rgba(38, 180, 180, 0.1);
  border: 2px dashed #26b4b4;
}

.drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.drag-overlay-content {
  text-align: center;
  padding: 2rem;
  border: 2px dashed #26b4b4;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.drag-overlay-content .drag-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.drag-overlay-content h3 {
  color: #333;
  margin-bottom: 0.5rem;
}

.drag-overlay-content p {
  color: #666;
  margin: 0;
  font-size: 0.9rem;
}

/* Mobile Responsive design */
@media (max-width: 768px) {
  .chat-container-with-sidebar {
    height: calc(100vh - 56px); /* Adjust for smaller mobile navbar */
  }

  .chat-container {
    height: calc(100vh - 56px);
  }

  /* On mobile, chat main takes full width since sidebar is overlay */
  .chat-main {
    margin-left: 0 !important;
    position: relative;
    z-index: 1;
  }

  .sidebar-open .chat-main,
  .sidebar-closed .chat-main {
    margin-left: 0;
  }

  .empty-state.welcome {
    margin: 1rem;
    padding: 1.5rem;
  }

  .empty-state.welcome h3 {
    font-size: 1.2rem;
  }

  .empty-state.welcome p {
    font-size: 0.9rem;
    max-width: 300px;
  }

  .drag-overlay-content {
    padding: 1.5rem;
    margin: 1rem;
  }

  .drag-overlay-content .drag-icon {
    font-size: 3rem;
  }

  .drag-overlay-content h3 {
    font-size: 1.1rem;
  }

  .drag-overlay-content p {
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .chat-container-with-sidebar {
    height: calc(100vh - 52px);
  }

  .chat-container {
    height: calc(100vh - 52px);
  }

  .empty-state.welcome {
    margin: 0.8rem;
    padding: 1.2rem;
  }

  .empty-state.welcome h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }

  .empty-state.welcome p {
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .drag-overlay-content {
    padding: 1.2rem;
    margin: 0.8rem;
  }

  .drag-overlay-content .drag-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
  }

  .drag-overlay-content h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }

  .drag-overlay-content p {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .chat-container-with-sidebar {
    height: calc(100vh - 48px);
  }

  .chat-container {
    height: calc(100vh - 48px);
  }

  .empty-state.welcome {
    margin: 0.5rem;
    padding: 1rem;
  }

  .empty-state.welcome h3 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
  }

  .empty-state.welcome p {
    font-size: 0.8rem;
    margin-bottom: 1.2rem;
    max-width: 250px;
  }

  .drag-overlay-content {
    padding: 1rem;
    margin: 0.5rem;
  }

  .drag-overlay-content .drag-icon {
    font-size: 2rem;
    margin-bottom: 0.6rem;
  }

  .drag-overlay-content h3 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }

  .drag-overlay-content p {
    font-size: 0.7rem;
  }

  .error-message,
  .success-message {
    font-size: 13px;
    padding: 8px;
    margin-bottom: 12px;
  }

  .chat-disclaimer {
    font-size: 0.7em;
    padding: 8px;
  }
}

/* Most specific: very small screens (420px and below) */
/* This must come AFTER the 480px query to ensure proper cascade */
@media (max-width: 420px) {
  .chat-container-with-sidebar {
    height: calc(100vh - 52px); /* Smaller navbar on tiny screens */
  }

  .chat-container {
    height: calc(100vh - 52px);
  }

  .empty-state.welcome {
    margin: 0.5rem;
    padding: 1rem;
  }

  .empty-state.welcome h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }

  .empty-state.welcome p {
    font-size: 0.85rem;
    max-width: 250px;
    margin-bottom: 1.5rem;
  }

  .drag-overlay-content {
    padding: 1rem;
    margin: 0.5rem;
  }

  .drag-overlay-content .drag-icon {
    font-size: 2.5rem;
  }

  .drag-overlay-content h3 {
    font-size: 1rem;
  }

  .drag-overlay-content p {
    font-size: 0.75rem;
  }
}

/* Messages Container and List Styles */
.messages-container {
  flex: 1 1 auto;
  min-height: 0; /* Allow shrinking */
  overflow-y: auto;
  padding: 15px;
  background: #f9f9f9;
  scroll-behavior: smooth;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: auto;
  overflow-y: visible;
  will-change: transform;
}

/* Message wrappers */
.message-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0px;
}

.message-wrapper.user {
  align-items: flex-end;
}

.message-wrapper.bot,
.message-wrapper.error {
  align-items: flex-start;
}

/* Message bubbles */
.message {
  max-width: 85%;
  padding: 0.5em 0.8em;
  margin: 0;
  border-radius: 8px;
  line-height: 1.4;
  transition: all 0.3s ease;
  width: auto;
}

.message.user {
  background: #0e8a93;
  color: white;
  text-align: left;
}

/* Override backgrounds for user messages to maintain consistent teal background */
.message.user .message-text pre {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.message.user .message-text code:not(pre code) {
  background: rgba(255, 255, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.message.user .message-text th {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.message.user .message-text tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

.message.user .message-text table {
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.message.user .message-text th,
.message.user .message-text td {
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.message.bot {
  background: transparent;
  color: #333;
  border: none;
  text-align: left;
  max-width: 95%;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.message.streaming {
  background: transparent;
  border: none;
  animation: fadeIn 0.3s ease-in;
}

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

/* Message text content */
.message-text {
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14px;
}

.message-text pre {
  background: #f5f5f5;
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid #e0e0e0;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  white-space: pre;
}

.message-text pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
  word-wrap: normal;
  white-space: pre;
  overflow-wrap: normal;
  display: block;
  line-height: inherit;
}

.message-text p,
.message-text div {
  margin: 8px 0;
}

.message-text ul,
.message-text ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-text ul {
  list-style-type: disc;
}

.message-text ol {
  list-style-type: decimal;
}

.message-text li {
  margin: 4px 0;
  line-height: 1.5;
}

.message-text li > p {
  margin: 0;
  display: inline;
}

.message-text > *:first-child {
  margin-top: 0;
}

.message-text > *:last-child {
  margin-bottom: 0;
}

.message-text ul + ul,
.message-text ol + ol,
.message-text ul + ol,
.message-text ol + ul {
  margin-top: -4px;
}

.message-text li > ul,
.message-text li > ol {
  margin: 4px 0;
  padding-left: 16px;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
  margin: 16px 0 8px 0;
  font-weight: 600;
}

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child,
.message-text h4:first-child {
  margin-top: 0;
}

.message-text p {
  margin: 8px 0;
  line-height: 1.6;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text code:not(pre code) {
  background: #f1f1f1;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  color: #d63384;
  border: 1px solid #e0e0e0;
}

.message-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 14px;
}

.message-text th,
.message-text td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: left;
}

.message-text th {
  background-color: #f5f5f5;
  font-weight: 600;
}

.message-text tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* Copy button for code blocks */
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #333;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.copy-button:hover {
  background: #555;
}

.message-text pre:hover .copy-button {
  opacity: 1;
}

/* Message action buttons */
.edit-message-button,
.copy-message-button {
  background: none;
  color: #666;
  border: none;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  margin-left: 6px;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.edit-message-button:hover,
.copy-message-button:hover {
  background: #f0f0f0;
  color: #333;
}

.edit-message-button-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message-wrapper.user .edit-message-button-container {
  justify-content: flex-end;
}

.message-wrapper.bot .edit-message-button-container,
.message-wrapper.error .edit-message-button-container {
  justify-content: flex-start;
}

.message-wrapper:hover .edit-message-button-container {
  opacity: 1;
}

/* Source citations */
.sources {
  margin-top: 8px;
  font-size: 0.85em;
  color: #666;
}

.sources h4 {
  margin: 0 0 5px 0;
  font-size: 0.9em;
}

.sources ul {
  margin: 0;
  padding-left: 20px;
}

/* Message footer */
.message-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.8em;
  color: #888;
}

.model-tag {
  background-color: #e9ecef;
  color: #495057;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: 500;
}

.model-tag[data-provider="openai"] {
  background-color: #e8f5e8;
  color: #2d5a3d;
}

.model-tag[data-provider="anthropic"] {
  background-color: #fff3cd;
  color: #856404;
}

.model-tag[data-provider="gemini"] {
  background-color: #d1ecf1;
  color: #0c5460;
}

.model-tag[data-provider="deepseek"] {
  background-color: #f8d7da;
  color: #721c24;
}

.model-tag[data-provider="grok"] {
  background-color: #e2e3e5;
  color: #383d41;
}

.model-tag[data-provider="qwen"] {
  background-color: #d4edda;
  color: #155724;
}

.model-tag[data-provider="cohere"] {
  background-color: #cce5ff;
  color: #004085;
}

.processing-time {
  font-size: 0.8em;
  color: #888;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #999;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .messages-container {
    padding: 12px;
  }

  .message {
    max-width: 92%;
  }

  .message.bot {
    max-width: 98%;
  }

  .message-text {
    font-size: 14px;
    line-height: 1.5;
  }

  .message-text pre {
    font-size: 13px;
    padding: 10px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  /* Improve table responsiveness on mobile */
  .message-text table {
    font-size: 12px;
    border-collapse: collapse;
    width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }

  .message-text th,
  .message-text td {
    padding: 6px 8px;
    min-width: 80px;
  }
}

@media (max-width: 640px) {
  .messages-container {
    padding: 10px;
  }

  .message {
    max-width: 95%;
    padding: 0.6em 0.9em;
  }

  .message.bot {
    max-width: 100%;
  }

  .message-text {
    font-size: 13px;
  }

  .message-text pre {
    font-size: 12px;
    padding: 8px;
    margin: 8px 0;
  }

  .message-text p,
  .message-text div {
    margin: 6px 0;
  }

  .message-text ul,
  .message-text ol {
    padding-left: 16px;
    margin: 6px 0;
  }
}

@media (max-width: 480px) {
  .messages-container {
    padding: 8px;
  }

  .messages {
    gap: 12px;
  }

  .message {
    max-width: 98%;
    padding: 0.5em 0.7em;
  }

  .message-text {
    font-size: 12px;
    line-height: 1.4;
  }

  .message-text pre {
    font-size: 11px;
    padding: 6px;
    margin: 6px 0;
  }

  .message-text table {
    font-size: 10px;
  }

  .message-text th,
  .message-text td {
    padding: 4px 6px;
    min-width: 60px;
  }
}

/* CSS Variables for dynamic button spacing - Default Desktop */
:root {
  --chat-button-size: 30px;
  --chat-button-gap: 10px;
  --chat-edge-spacing: 10px;
  --chat-input-padding-right: 80px; /* 30 + 10 + 30 + 10 = 80px */
}

/* Chat Input Container Styles */
.chat-input-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f9f9f9;
  padding: 15px;
  margin: 0;
  gap: 10px;
  flex-shrink: 0; /* Prevent shrinking too much */
  max-height: 300px; /* Limit total height of input area */
}

.input-wrapper {
  position: relative;
  width: 70%;
  max-width: 750px;
  min-width: 300px; /* Ensure minimum space for input text */
}

.chat-input {
  width: 100%;
  padding: 12px 80px 12px 15px; /* Fixed padding to prevent overlap */
  border: 1px solid #ddd;
  border-radius: 25px;
  font-size: 14px;
  max-height: 150px;
  min-height: 24px;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  resize: none;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.4;
  transition:
    height 0.2s ease,
    border-color 0.2s ease;
  font-family: Arial, sans-serif;
  vertical-align: middle;
  margin: 0;
  background-color: white;
  color: #333;
  box-sizing: border-box;
  /* Hide scrollbar while maintaining scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for webkit browsers (Chrome, Safari, etc.) */
.chat-input::-webkit-scrollbar {
  display: none;
}

.chat-input:focus {
  outline: none;
  border-color: #9ca3af;
}

/* Send button */
.send-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #999;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  font-size: 14px;
  padding: 0;
  z-index: 10;
  flex-shrink: 0; /* Prevent button from shrinking */
}

.send-button:hover:not(:disabled) {
  background-color: #777;
}

.send-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.send-button.stop-mode {
  background-color: #999;
}

/* Paperclip button */
.paperclip-button {
  position: absolute;
  right: 50px; /* 30px (button) + 10px (gap) + 10px (edge) = 50px */
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #999;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  font-size: 14px;
  padding: 0;
  z-index: 10;
  flex-shrink: 0; /* Prevent button from shrinking */
}

.paperclip-button:hover:not(:disabled) {
  background-color: #777;
}

.paperclip-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Button icons */
.send-icon,
.stop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.stop-icon {
  font-size: 12px;
}

/* Input validation styles */
.input-validation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 70%;
  max-width: 750px;
  min-width: 300px; /* Match input wrapper */
  margin-top: 5px;
  font-size: 12px;
}

.character-counter {
  color: #666;
  font-size: 11px;
  text-align: right;
  margin-left: auto;
  transition: color 0.2s ease;
}

.character-counter.warning {
  color: #f57c00;
}

.character-counter.error {
  color: #d32f2f;
  font-weight: bold;
}

.validation-error {
  color: #d32f2f;
  font-size: 11px;
  background-color: #ffebee;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #ffcdd2;
  margin-right: auto;
}

/* Cancel edit button */
.cancel-edit-button {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  margin-top: 10px;
}

.cancel-edit-button:hover {
  background-color: #5a6268;
}

/* Stop button (when streaming) */
.stop-button {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.stop-button:hover {
  background-color: #c82333;
}

/* Mobile Responsive design */
@media (max-width: 768px) {
  .chat-input-container {
    padding: 12px;
    gap: 8px;
    max-height: 250px; /* Smaller max height on mobile */
  }

  .input-wrapper {
    width: 85%;
    min-width: 280px;
    max-width: 600px;
  }

  .chat-input {
    padding: 14px 88px 14px 16px; /* 34 + 8 + 34 + 12 = 88px */
    font-size: 15px;
    border-radius: 22px;
    min-height: 28px;
  }

  .send-button {
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .paperclip-button {
    right: 54px; /* 34 + 8 + 12 = 54px */
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .cancel-edit-button,
  .stop-button {
    padding: 10px 18px;
    font-size: 15px;
    margin-top: 8px;
  }

  .input-validation {
    width: 85%;
    min-width: 280px;
    max-width: 600px;
    margin-top: 4px;
  }

  .character-counter {
    font-size: 10px;
  }

  .validation-error {
    font-size: 10px;
    padding: 3px 6px;
  }
}

@media (max-width: 640px) {
  .chat-input-container {
    padding: 10px;
    gap: 6px;
  }

  .input-wrapper {
    width: 90%;
    min-width: 260px;
  }

  .chat-input {
    padding: 12px 82px 12px 14px; /* 32 + 8 + 32 + 10 = 82px */
    font-size: 14px;
    border-radius: 20px;
  }

  .send-button {
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .paperclip-button {
    right: 50px; /* 32 + 8 + 10 = 50px */
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .cancel-edit-button,
  .stop-button {
    padding: 9px 16px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .chat-input-container {
    padding: 8px;
    gap: 5px;
  }

  .input-wrapper {
    width: 95%;
    min-width: 240px;
  }

  .chat-input {
    padding: 10px 76px 10px 12px; /* 30 + 8 + 30 + 8 = 76px */
    font-size: 13px;
    border-radius: 18px;
    min-height: 22px;
  }

  .send-button {
    right: 8px;
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .paperclip-button {
    right: 46px; /* 30 + 8 + 8 = 46px */
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .cancel-edit-button,
  .stop-button {
    padding: 8px 14px;
    font-size: 13px;
    margin-top: 6px;
  }
}

@media (max-width: 360px) {
  .input-wrapper {
    width: 98%;
    min-width: 220px;
  }

  .chat-input {
    padding: 8px 70px 8px 10px; /* 28 + 6 + 28 + 8 = 70px */
    font-size: 12px;
    border-radius: 16px;
    min-height: 20px;
  }

  .send-button {
    right: 8px;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .paperclip-button {
    right: 42px; /* 28 + 6 + 8 = 42px */
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .cancel-edit-button,
  .stop-button {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* File Upload Related Styles */

/* Upload progress overlay */
.upload-progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.upload-progress-content {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
}

.upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.upload-progress-content h4 {
  margin: 0;
  color: #333;
  font-size: 1.1em;
}

.cancel-upload-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.cancel-upload-button:hover {
  background-color: #f0f0f0;
  color: #333;
}

.cancel-upload-button:active {
  background-color: #e0e0e0;
}

.file-progress-item {
  margin-bottom: 16px;
}

.file-progress-item:last-child {
  margin-bottom: 0;
}

.file-progress-item .file-name {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  word-break: break-word;
}

.progress-bar-container {
  position: relative;
  height: 20px;
  background-color: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: #26B4B4;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-bar-container.success .progress-bar {
  background-color: #28a745;
}

.progress-bar-container.error .progress-bar {
  background-color: #dc3545;
}

.progress-bar-container.cancelled .progress-bar {
  background-color: #6c757d;
}

.progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: #333;
}

.progress-bar-container.success .progress-text {
  color: #28a745;
}

.progress-bar-container.error .progress-text {
  color: #dc3545;
}

.error-text {
  font-size: 12px;
  color: #dc3545;
  margin-top: 4px;
}

/* Responsive design */
@media (max-width: 600px) {
  .upload-progress-content {
    padding: 16px;
    max-width: 95%;
  }
  
  .upload-progress-header {
    margin-bottom: 16px;
  }
  
  .file-progress-item {
    margin-bottom: 12px;
  }
  
  .file-progress-item .file-name {
    font-size: 13px;
  }
  
  .progress-bar-container {
    height: 18px;
  }
  
  .progress-text {
    font-size: 11px;
  }
} 
