/* Chat Input Area */
.chat-input-area {
  padding: 16px;
  background: var(--bg-light);
  border-top: 1px solid var(--border);
}

#chat-form {
  display: flex;
  gap: 12px;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: none;
  overflow-y: hidden;
  min-height: 44px;
  max-height: 200px;
  font-family: inherit;
}

#message-input:focus {
  border-color: var(--accent);
}

#message-input::placeholder {
  color: var(--text-muted);
}

#send-btn {
  padding: 12px 20px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-end;
}

#send-btn:hover {
  background: var(--accent-hover);
}

#send-btn:disabled {
  background: var(--bg-lighter);
  color: var(--text-muted);
  cursor: not-allowed;
}

#send-btn.hidden {
  display: none;
}

#stop-btn {
  padding: 12px 20px;
  background: var(--error);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-end;
}

#stop-btn:hover {
  background: #dc2626;
}

#stop-btn.hidden {
  display: none;
}

/* Drag-over indicator (highlights entire chat panel) */
.chat-panel.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
}

/* Attachment preview area (pending attachments before send) */
#attachment-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}


.image-preview-chip {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-remove:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Inline image thumbnails in sent messages */
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.message-image-thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity 0.15s;
}

.message-image-thumb:hover {
  opacity: 0.8;
}

/* Full-size image preview overlay */
.image-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.image-preview-wrapper {
  position: relative;
  display: inline-block;
}

.image-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.image-preview-full {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-preview-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.image-preview-nav:hover {
  background: rgba(255, 255, 255, 0.35);
}

.image-preview-nav-left {
  left: 20px;
}

.image-preview-nav-right {
  right: 20px;
}

.image-preview-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  white-space: nowrap;
  z-index: 10001;
}

/* File preview chip (pending PDF/text attachments before send) */
.file-preview-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  max-width: 200px;
}

.file-preview-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.file-preview-size {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 11px;
}

/* Inline file chips in sent messages */
.message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.message-file-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file-chip:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-lighter));
}

/* PDF preview iframe in overlay */
.pdf-preview-frame {
  width: 80vw;
  height: 85vh;
  border: none;
  border-radius: 8px;
  background: white;
}

/* File content overlay (click-to-view for text files) */
.file-content-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.file-content-container {
  width: 80vw;
  max-height: 85vh;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: default;
}

.file-content-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

.file-content-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
}
