/* AdTribe Agent - Chat Interface Styles */
/* Claude Desktop-like UI */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-message-user: #0f3460;
  --bg-message-assistant: #1e1e2e;
  --bg-tool: #252536;
  --bg-tool-header: #2a2a3d;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;
  --border: #333355;
  --border-light: #404060;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status {
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status.connected {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.account-context {
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.account-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-radius: 1rem;
  font-weight: 500;
  font-size: 0.7rem;
}

.account-details {
  background: rgba(59, 130, 246, 0.08);
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  border-left: 3px solid var(--accent);
}

.account-details p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

.account-details strong {
  color: var(--text-primary);
}

.bm-list {
  margin: 0.5rem 0 0 1.5rem;
  padding: 0;
}

.bm-list li {
  margin: 0.3rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.status.disconnected {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

/* Buttons */
.btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tool);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tool-header);
}

/* Chat History Sidebar (overlay style) */
.chat-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.chat-sidebar.open {
  transform: translateX(0);
}

/* Overlay backdrop when sidebar is open */
.chat-sidebar.open::after {
  content: '';
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.sidebar-header .btn-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0.9rem;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.loading-sessions,
.no-sessions,
.sessions-error {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sessions-error {
  color: var(--error);
}

.session-group {
  margin-bottom: 1rem;
}

.session-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.session-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.25rem;
}

.session-item:hover {
  background: var(--bg-tool);
}

.session-item.active {
  background: var(--bg-tool);
  border-left: 3px solid var(--accent);
}

.session-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 85%;
    max-width: 300px;
  }

  .chat-sidebar.open::after {
    left: 85%;
  }
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

/* Scroll to bottom button */
.scroll-to-bottom-btn {
  position: fixed;
  bottom: 120px; /* Above the input area */
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s, background 0.2s;
  z-index: 1000;
}

.scroll-to-bottom-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-bottom-btn:hover {
  background: var(--accent-hover);
  transform: translateX(-50%) scale(1.1);
}

.scroll-to-bottom-btn:active {
  transform: translateX(-50%) scale(0.95);
}

.scroll-to-bottom-btn i {
  font-size: 1.2rem;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.welcome-message h2 {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.welcome-message p {
  margin-bottom: 0.5rem;
}

.welcome-message ul {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.welcome-message li {
  padding: 0.6rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.welcome-message li:hover {
  background: var(--bg-tool);
  border-color: var(--border-light);
}

/* Message Styles */
.message {
  max-width: 100%;
  line-height: 1.6;
}

.message.user {
  align-self: flex-end;
  background: var(--bg-message-user);
  padding: 0.75rem 1rem;
  border-radius: 1rem 1rem 0.25rem 1rem;
  max-width: 80%;
}

.message.user .message-images {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.message.user .message-images img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 0.5rem;
  object-fit: cover;
}

.message.user .message-text {
  white-space: pre-wrap;
}

.message.user .message-files {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.message.user .message-file {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
}

.message.assistant {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Thinking Indicator */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.thinking-dots {
  display: flex;
  gap: 0.2rem;
}

.thinking-dots span {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Tool Calls Container */
.tool-calls-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Tool Call - Collapsible */
.tool-call {
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  font-size: 0.85rem;
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tool-header);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.tool-call-header:hover {
  background: #32324a;
}

.tool-icon {
  font-size: 0.9rem;
}

.tool-description {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.tool-name {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
}

.tool-server {
  display: none; /* Hide server name since we show description */
}

.tool-status {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
}

.tool-status.pending {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}

.tool-status.success {
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.tool-status.error {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.tool-toggle {
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.tool-call.collapsed .tool-toggle {
  transform: rotate(0deg);
}

.tool-call:not(.collapsed) .tool-toggle {
  transform: rotate(90deg);
}

/* Tool Call Body - Hidden when collapsed */
.tool-call-body {
  display: block;
  border-top: 1px solid var(--border);
}

.tool-call.collapsed .tool-call-body {
  display: none;
}

.tool-section {
  padding: 0.5rem 0.75rem;
}

.tool-section + .tool-section {
  border-top: 1px solid var(--border);
}

.tool-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.tool-section-content {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.25rem;
  overflow: hidden;
}

.tool-section-content pre {
  margin: 0;
  padding: 0.5rem;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
  color: var(--text-secondary);
}

/* Final Response */
.final-response {
  background: var(--bg-message-assistant);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  line-height: 1.7;
}

.final-response h1,
.final-response h2,
.final-response h3,
.final-response h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.final-response h1:first-child,
.final-response h2:first-child,
.final-response h3:first-child {
  margin-top: 0;
}

.final-response p {
  margin-bottom: 0.75rem;
}

.final-response p:last-child {
  margin-bottom: 0;
}

.final-response ul,
.final-response ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.final-response li {
  margin-bottom: 0.25rem;
}

.final-response pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.final-response code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
}

.final-response p code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
}

.final-response table {
  border-collapse: collapse;
  margin: 0.75rem 0;
  width: 100%;
  font-size: 0.9rem;
}

.final-response th,
.final-response td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.final-response th {
  background: var(--bg-tool);
  font-weight: 500;
}

.final-response blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 0.75rem 0;
  color: var(--text-secondary);
}

/* Error Message */
.error-message {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-icon {
  font-size: 1rem;
}

/* Authentication Error */
.auth-error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem;
}

.auth-error {
  text-align: center;
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 3rem 2rem;
  max-width: 400px;
}

.auth-error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.auth-error h2 {
  color: var(--error);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.auth-error p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.auth-error-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-error-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background 0.2s;
}

.auth-error-link:hover {
  background: var(--accent-hover);
}

/* Input Area */
.input-area {
  padding: 0.75rem 1.5rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.input-area.drag-over {
  background: rgba(233, 69, 96, 0.1);
  border-top-color: var(--accent);
}

/* Attachments Preview */
.attachments-preview {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.attachment-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-item.file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-tool);
  padding: 0.25rem;
}

.attachment-item .file-icon {
  font-size: 1.5rem;
}

.attachment-item .file-name {
  font-size: 0.6rem;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-all;
}

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

.attachment-remove:hover {
  background: var(--error);
}

.input-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  text-align: center;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-tool-header);
}

#message-input {
  flex: 1;
  padding: 0.65rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  resize: none;
  min-height: 42px;
  max-height: 200px;
  font-family: inherit;
  line-height: 1.4;
}

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

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

#send-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-icon {
  font-size: 1.1rem;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Template list in welcome message */
.template-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
}

.template-list .template-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tool) 100%);
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.template-list .template-item:hover {
  background: var(--bg-tool);
  border-color: var(--accent-hover);
  transform: translateX(4px);
}

/* Response Action Buttons */
.response-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--bg-tool-header);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn.success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border-color: var(--success);
}

.action-btn.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border-color: var(--error);
}

.action-btn.slack-btn {
  background: rgba(74, 21, 75, 0.2);
  border-color: #611f69;
}

.action-btn.slack-btn:hover {
  background: rgba(74, 21, 75, 0.4);
  border-color: #8b3493;
}

.action-icon {
  font-size: 0.9rem;
}

/* Context Preview */
.context-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 0.5rem;
  font-size: 0.85rem;
}

.context-preview-icon {
  font-size: 1.2rem;
}

.context-preview-info {
  flex: 1;
}

.context-preview-title {
  font-weight: 600;
  color: var(--text-primary);
}

.context-preview-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.context-preview-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.context-preview-remove:hover {
  background: rgba(248, 113, 113, 0.4);
}

/* Context Picker Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-tool);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.context-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.context-tab {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.context-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tool);
}

.context-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.context-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.context-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.context-item:hover {
  background: var(--bg-tool);
  border-color: var(--border);
}

.context-item-icon {
  font-size: 1.5rem;
}

.context-item-info {
  flex: 1;
  min-width: 0;
}

.context-item-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-item-id {
  color: var(--text-secondary);
  font-weight: 400;
  margin-right: 0.25rem;
}

.context-item-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.context-item-status {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
}

.context-item-status.generated {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.context-item-status.pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.context-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* Stop Button Styles */
#send-btn.stop-btn {
  background: var(--error);
}

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

#send-btn.stop-btn .send-icon {
  font-size: 1rem;
}

/* Save to Report/Template Button */
.action-btn.save-btn {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
}

.action-btn.save-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #60a5fa;
}

/* Save Confirmation Modal */
.save-confirm-modal .modal-content {
  max-width: 400px;
}

.save-confirm-body {
  padding: 1.5rem;
}

.save-confirm-body p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.save-confirm-field {
  margin-bottom: 1rem;
}

.save-confirm-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.save-confirm-field input,
.save-confirm-field textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.save-confirm-field textarea {
  min-height: 80px;
  resize: vertical;
}

.save-confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.save-confirm-actions .btn {
  padding: 0.5rem 1rem;
}

/* Notification Popup (instead of alert) */
.notification-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  max-width: 400px;
  animation: notification-slide-in 0.3s ease;
}

@keyframes notification-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-popup.notification-fade-out {
  animation: notification-fade-out 0.3s ease forwards;
}

@keyframes notification-fade-out {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.notification-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.notification-error .notification-content {
  border-color: var(--error);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.1) 0%, var(--bg-secondary) 100%);
}

.notification-warning .notification-content {
  border-color: var(--warning);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, var(--bg-secondary) 100%);
}

.notification-info .notification-content {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, var(--bg-secondary) 100%);
}

.notification-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.notification-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: -0.25rem -0.25rem -0.25rem 0;
}

.notification-close:hover {
  background: var(--bg-tool);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    max-width: 100%;
  }

  .message.user {
    max-width: 90%;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .chat-container {
    padding: 1rem;
  }

  .response-actions {
    gap: 0.4rem;
  }

  .action-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* ========== SLACK MODAL STYLES ========== */
.slack-modal .modal-body {
  padding: 1.25rem;
  overflow: visible;
}

.slack-modal .modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.slack-modal .slack-icon {
  margin-right: 0.25rem;
}

/* Form Elements */
.slack-modal .form-group {
  margin-bottom: 1rem;
}

.slack-modal .form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.slack-modal .form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.slack-modal .form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.slack-modal .form-select:focus {
  outline: none;
  border-color: var(--accent);
}

.slack-modal .form-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.slack-modal .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.slack-modal .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.slack-modal .form-textarea::placeholder {
  color: var(--text-muted);
}

/* Checkbox Group */
.slack-modal .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slack-modal .checkbox-label {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.slack-modal .checkbox-label:hover {
  border-color: var(--accent);
}

.slack-modal .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.slack-modal .checkbox-label span {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.slack-modal .checkbox-label .form-hint {
  width: 100%;
  margin-left: 24px;
  margin-top: 0;
}

/* Modal Alert */
.slack-modal .modal-alert {
  padding: 0.75rem 1rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.slack-modal .modal-alert.hidden {
  display: none;
}

.slack-modal .modal-alert.error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid var(--error);
  color: var(--error);
}

.slack-modal .modal-alert.success {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

/* Buttons */
.slack-modal .btn {
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.slack-modal .btn-secondary {
  background: var(--bg-tool);
  color: var(--text-secondary);
  border-color: var(--border);
}

.slack-modal .btn-secondary:hover {
  background: var(--bg-tool-header);
  color: var(--text-primary);
}

.slack-modal .btn-primary {
  background: #611f69;
  color: white;
}

.slack-modal .btn-primary:hover {
  background: #8b3493;
}

.slack-modal .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.slack-modal .spinner {
  display: inline-block;
  margin-right: 0.25rem;
}
