/**
 * Agent Widget Styles
 * These styles are scoped to .agent-widget-* classes to avoid conflicts
 */

.agent-widget-button {
  position: fixed;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--agent-widget-primary, #6366f1) 0%,
    var(--agent-widget-secondary, #818cf8) 100%
  );
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  z-index: var(--agent-widget-z-index, 999999);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-widget-button.position-right {
  right: 20px;
}

.agent-widget-button.position-left {
  left: 20px;
}

.agent-widget-button:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.agent-widget-button svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.agent-widget-container {
  position: fixed;
  bottom: 90px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 650px;
  max-height: calc(100vh - 110px);
  background: white;
  border-radius: var(--agent-widget-border-radius, 16px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 1px rgba(0, 0, 0, 0.1);
  z-index: var(--agent-widget-z-index, 999999);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(
    --agent-widget-font-family,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif
  );
}

.agent-widget-container.position-right {
  right: 20px;
}

.agent-widget-container.position-left {
  left: 20px;
}

.agent-widget-container.open {
  display: flex;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.agent-widget-header {
  background: linear-gradient(
    135deg,
    var(--agent-widget-primary, #6366f1) 0%,
    var(--agent-widget-secondary, #818cf8) 100%
  );
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.agent-widget-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-widget-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-widget-header-avatar svg {
  width: 20px;
  height: 20px;
}

.agent-widget-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: white;
}

.agent-widget-header-actions {
  display: flex;
  gap: 8px;
}

.agent-widget-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.agent-widget-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.agent-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--agent-widget-bg, #f8fafc);
  scroll-behavior: smooth;
}

.agent-widget-bottom-spacer {
  flex-shrink: 0;
  pointer-events: none;
}

.agent-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.agent-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.agent-widget-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.agent-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.agent-widget-message {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: messageSlide 0.3s ease-out;
}

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

.agent-widget-message-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.agent-widget-message.user .agent-widget-message-top {
  flex-direction: row-reverse;
}

.agent-widget-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-widget-message-avatar svg {
  width: 16px;
  height: 16px;
}

.agent-widget-message.assistant .agent-widget-message-avatar {
  background: linear-gradient(
    135deg,
    var(--agent-widget-primary, #6366f1) 0%,
    var(--agent-widget-secondary, #818cf8) 100%
  );
  color: white;
}

.agent-widget-message.user .agent-widget-message-avatar {
  background: #e2e8f0;
  color: var(--agent-widget-text, #1e293b);
}

.agent-widget-message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.agent-widget-message.assistant .agent-widget-message-content {
  background: var(--agent-widget-assistant-bg, #ffffff);
  color: var(--agent-widget-text, #1e293b);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 4px;
}

.agent-widget-message.user .agent-widget-message-content {
  background: linear-gradient(
    135deg,
    var(--agent-widget-user-msg, #6366f1) 0%,
    var(--agent-widget-secondary, #818cf8) 100%
  );
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  border-bottom-right-radius: 4px;
}

.agent-widget-sources {
  margin-left: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.agent-widget-sources-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.agent-widget-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-widget-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #dbe4ff;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.agent-widget-container.light-mode .agent-widget-sources-label {
  color: #64748b;
}

.agent-widget-container.light-mode .agent-widget-source-chip {
  border-color: #dbe4ff;
  background: #ffffff;
  color: #334155;
}

.agent-widget-container.light-mode .agent-widget-source-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.agent-widget-container.light-mode .agent-widget-source-score {
  color: #2563eb;
}

.agent-widget-source-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.agent-widget-source-chip.is-static {
  cursor: default;
}

.agent-widget-source-score {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
}

/* Markdown styling */
.agent-widget-message-content h1,
.agent-widget-message-content h2,
.agent-widget-message-content h3 {
  color: var(--agent-widget-text, #1e293b);
  font-weight: 600;
  line-height: 1.3;
}

.agent-widget-message-content h1 {
  font-size: 1.3em;
  margin: 0.75em 0 0.5em;
}

.agent-widget-message-content h2 {
  font-size: 1.2em;
  margin: 0.75em 0 0.5em;
}

.agent-widget-message-content h3 {
  font-size: 1.1em;
  margin: 0.75em 0 0.5em;
}

.agent-widget-message-content h1:first-child,
.agent-widget-message-content h2:first-child,
.agent-widget-message-content h3:first-child {
  margin-top: 0;
}

.agent-widget-message-content p {
  margin: 0.5em 0;
  line-height: 1.6;
  color: var(--agent-widget-text, #1e293b);
}

.agent-widget-message-content p:first-child {
  margin-top: 0;
}

.agent-widget-message-content p:last-child {
  margin-bottom: 0;
}

.agent-widget-message-content code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 0.9em;
  color: #e83e8c;
}

.agent-widget-message-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
  font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 0.85em;
  line-height: 1.5;
}

.agent-widget-message-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.agent-widget-message-content ul,
.agent-widget-message-content ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
  color: var(--agent-widget-text, #1e293b);
}

.agent-widget-message-content ul {
  list-style-type: disc;
}

.agent-widget-message-content ol {
  list-style-type: decimal;
}

.agent-widget-message-content li {
  margin: 0.25em 0;
  line-height: 1.6;
}

.agent-widget-message-content a {
  color: var(--agent-widget-primary, #6366f1);
  text-decoration: underline;
}

.agent-widget-message-content a:hover {
  opacity: 0.8;
}

.agent-widget-message-content strong {
  font-weight: 600;
}

.agent-widget-message-content blockquote {
  border-left: 4px solid var(--agent-widget-primary, #6366f1);
  padding-left: 1em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  margin: 1em 0;
  background: rgba(99, 102, 241, 0.05);
  font-style: italic;
}

.agent-widget-message-content hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1.5em 0;
}

.agent-widget-table-wrap {
  width: 100%;
  margin: 1em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.agent-widget-message-content table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9em;
}

.agent-widget-message-content table thead {
  background: rgba(0, 0, 0, 0.05);
}

.agent-widget-message-content table th,
.agent-widget-message-content table td {
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.agent-widget-message-content table th {
  font-weight: 700;
}

.agent-widget-message-content table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}

.agent-widget-message-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1em 0;
}

/* Reasoning panel */
.agent-widget-reasoning-panel {
  margin: 0 0 12px 0;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
  transition: all 0.3s ease;
}

.agent-widget-reasoning-header {
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.05);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.agent-widget-reasoning-header:hover {
  background: rgba(99, 102, 241, 0.1);
}

.agent-widget-reasoning-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--agent-widget-primary, #6366f1);
}

.agent-widget-reasoning-step-count {
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
}

.agent-widget-reasoning-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--agent-widget-primary, #6366f1);
  transition: transform 0.3s ease;
}

.agent-widget-reasoning-panel.collapsed .agent-widget-reasoning-toggle {
  transform: rotate(-90deg);
}

.agent-widget-reasoning-content {
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.agent-widget-reasoning-panel.collapsed .agent-widget-reasoning-content {
  max-height: 0;
  overflow: hidden;
}

.agent-widget-reasoning-step {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
}

.agent-widget-reasoning-step:last-child {
  border-bottom: none;
}

.agent-widget-reasoning-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--agent-widget-primary, #6366f1);
  font-size: 12px;
}

.agent-widget-reasoning-step.tool-selection {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  margin: 8px 12px;
}

.agent-widget-reasoning-step.tool-selection .agent-widget-tool-name {
  font-weight: 600;
  color: #6b21a8;
  font-size: 13px;
}

.agent-widget-reasoning-step.tool-selection .agent-widget-tool-args {
  margin-top: 8px;
  padding: 8px;
  background: #f3e8ff;
  border-radius: 6px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 11px;
  color: #7c3aed;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Loading states */
.agent-widget-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--agent-widget-assistant-bg, #ffffff);
  border-radius: 16px;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.agent-widget-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--agent-widget-primary, #6366f1);
  animation: typing 1.4s infinite;
  opacity: 0.6;
}

.agent-widget-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.agent-widget-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.agent-widget-message-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agent-widget-message-loading-text {
  color: var(--agent-widget-text, #1e293b);
  font-size: 14px;
}

.agent-widget-message-loading-spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--agent-widget-primary, #6366f1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Input area */
.agent-widget-input-container {
  padding: 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 10px;
}

.agent-widget-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
  color: #333;
}

.agent-widget-input:focus {
  border-color: var(--agent-widget-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.agent-widget-send {
  padding: 12px 20px;
  background: linear-gradient(
    135deg,
    var(--agent-widget-primary, #6366f1) 0%,
    var(--agent-widget-secondary, #818cf8) 100%
  );
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.agent-widget-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.agent-widget-send:active:not(:disabled) {
  transform: translateY(0);
}

.agent-widget-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-widget-char-count {
  text-align: right;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 20px 8px;
  background: white;
}

.agent-widget-error {
  padding: 12px 16px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 12px;
  font-size: 13px;
  margin: 0 24px 16px;
  border-left: 3px solid #dc2626;
  animation: messageSlide 0.3s ease-out;
}

/* Dark mode */
.agent-widget-container.dark-mode {
  background: #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.agent-widget-container.dark-mode .agent-widget-messages {
  background: #0f172a;
}

.agent-widget-container.dark-mode
  .agent-widget-messages::-webkit-scrollbar-thumb {
  background: #475569;
}

.agent-widget-container.dark-mode
  .agent-widget-message.assistant
  .agent-widget-message-content {
  background: #1e293b;
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-message-content h1,
.agent-widget-container.dark-mode .agent-widget-message-content h2,
.agent-widget-container.dark-mode .agent-widget-message-content h3,
.agent-widget-container.dark-mode .agent-widget-message-content p {
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-message-content ul,
.agent-widget-container.dark-mode .agent-widget-message-content ol,
.agent-widget-container.dark-mode .agent-widget-message-content li,
.agent-widget-container.dark-mode .agent-widget-message-content blockquote {
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-message-content code {
  background: rgba(255, 255, 255, 0.15);
  color: #fbbf24;
}

.agent-widget-container.dark-mode .agent-widget-message-content pre {
  background: #0f172a;
  border: 1px solid #334155;
}

.agent-widget-container.dark-mode .agent-widget-message-content a {
  color: #818cf8;
}

.agent-widget-container.dark-mode .agent-widget-message-content hr {
  border-top-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-message-content blockquote {
  background: rgba(148, 163, 184, 0.08);
  border-left-color: #818cf8;
}

.agent-widget-container.dark-mode .agent-widget-table-wrap {
  border-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-message-content table thead {
  background: rgba(148, 163, 184, 0.1);
}

.agent-widget-container.dark-mode .agent-widget-message-content table th,
.agent-widget-container.dark-mode .agent-widget-message-content table td {
  border-color: #334155;
  color: #e2e8f0;
}

.agent-widget-container.dark-mode
  .agent-widget-message-content
  table
  tbody
  tr:nth-child(even) {
  background: rgba(148, 163, 184, 0.06);
}

.agent-widget-container.dark-mode .agent-widget-reasoning-panel {
  background: #1e293b;
  border-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-reasoning-header {
  background: rgba(148, 163, 184, 0.08);
  border-bottom-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-reasoning-header:hover {
  background: rgba(148, 163, 184, 0.14);
}

.agent-widget-container.dark-mode .agent-widget-reasoning-step-count {
  color: #94a3b8;
}

.agent-widget-container.dark-mode .agent-widget-reasoning-step {
  border-bottom-color: #334155;
  color: #e2e8f0;
}

.agent-widget-container.dark-mode
  .agent-widget-reasoning-step.tool-selection {
  background: #111827;
  border-color: #334155;
}

.agent-widget-container.dark-mode
  .agent-widget-reasoning-step.tool-selection
  .agent-widget-tool-name {
  color: #e2e8f0;
}

.agent-widget-container.dark-mode
  .agent-widget-reasoning-step.tool-selection
  .agent-widget-tool-args {
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
}

.agent-widget-container.dark-mode .agent-widget-typing {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.agent-widget-container.dark-mode .agent-widget-message-loading-text {
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-sources-label {
  color: #94a3b8;
}

.agent-widget-container.dark-mode .agent-widget-source-chip {
  border-color: #334155;
  background: #0f172a;
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-source-chip:hover {
  border-color: #475569;
  background: #1e293b;
  color: #bfdbfe;
}

.agent-widget-container.dark-mode .agent-widget-source-chip.is-static {
  border-color: #334155;
  background: #0f172a;
  color: #cbd5e1;
}

.agent-widget-container.dark-mode .agent-widget-source-score {
  color: #60a5fa;
}

.agent-widget-container.dark-mode .agent-widget-input-container {
  background: #1e293b;
  border-top-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-input::placeholder {
  color: #64748b;
}

.agent-widget-container.dark-mode .agent-widget-char-count {
  background: #1e293b;
  color: #94a3b8;
}

/* Responsive markdown tables for narrow widget widths */
@media (max-width: 560px) {
  .agent-widget-table-wrap {
    overflow: visible;
    border: none;
    border-radius: 0;
  }

  .agent-widget-message-content table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .agent-widget-message-content table thead {
    display: none;
  }

  .agent-widget-message-content table,
  .agent-widget-message-content table tbody,
  .agent-widget-message-content table tr,
  .agent-widget-message-content table td {
    display: block;
    width: 100%;
  }

  .agent-widget-message-content table tr {
    margin: 0 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.02);
  }

  .agent-widget-message-content table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.02);
  }

  .agent-widget-message-content table td {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 12px;
  }

  .agent-widget-message-content table td:last-child {
    border-bottom: none;
  }

  .agent-widget-message-content table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 0.78em;
    font-weight: 700;
    color: #64748b;
    text-transform: none;
  }

  .agent-widget-container.dark-mode .agent-widget-message-content table tr {
    border-color: #334155;
    background: rgba(148, 163, 184, 0.05);
  }

  .agent-widget-container.dark-mode .agent-widget-message-content table td {
    border-bottom-color: #334155;
  }

  .agent-widget-container.dark-mode .agent-widget-message-content table td::before {
    color: #94a3b8;
  }
}

/* Mobile responsive */
@media (max-width: 480px) {
  .agent-widget-container {
    width: calc(100vw - 20px);
    height: calc(100vh - 110px);
    bottom: 90px;
    left: 10px !important;
    right: 10px !important;
  }
}

/* ─── File upload: drop overlay ─────────────────────────────────── */

.agent-widget-drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(99, 102, 241, 0.08);
  border: 2px dashed var(--agent-widget-primary, #6366f1);
  border-radius: var(--agent-widget-border-radius, 16px);
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.agent-widget-drop-overlay.active {
  display: flex;
}

.agent-widget-drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--agent-widget-primary, #6366f1);
  font-size: 15px;
  font-weight: 600;
}

.agent-widget-drop-overlay-content svg {
  width: 40px;
  height: 40px;
  opacity: 0.8;
}

/* ─── File upload: attachment bar ───────────────────────────────── */

.agent-widget-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.agent-widget-attachment-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  max-width: 200px;
}

.agent-widget-attachment-name {
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.agent-widget-attachment-size {
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.agent-widget-attachment-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.agent-widget-attachment-remove:hover {
  color: #ef4444;
}

/* ─── Attached files shown below user message ───────────────────── */

.agent-widget-message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.agent-widget-message-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  opacity: 0.85;
}

.agent-widget-message-file-size {
  opacity: 0.7;
  font-size: 10px;
}

.agent-widget-container.dark-mode .agent-widget-message-file-chip {
  background: rgba(255, 255, 255, 0.1);
}

.agent-widget-upload-status {
  font-size: 12px;
  color: #6366f1;
  padding: 2px 4px;
  font-style: italic;
}

/* ─── File upload: attach button ────────────────────────────────── */

.agent-widget-attach-button {
  padding: 10px;
  background: none;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.agent-widget-attach-button:hover {
  border-color: var(--agent-widget-primary, #6366f1);
  color: var(--agent-widget-primary, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}

/* ─── Dark mode overrides ───────────────────────────────────────── */

.agent-widget-container.dark-mode .agent-widget-drop-overlay {
  background: rgba(99, 102, 241, 0.12);
}

.agent-widget-container.dark-mode .agent-widget-attachments {
  background: #1e293b;
  border-top-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-attachment-chip {
  background: #0f172a;
  border-color: #334155;
}

.agent-widget-container.dark-mode .agent-widget-attachment-name {
  color: #e2e8f0;
}

.agent-widget-container.dark-mode .agent-widget-attachment-size {
  color: #64748b;
}

.agent-widget-container.dark-mode .agent-widget-attach-button {
  border-color: #334155;
  color: #94a3b8;
}

.agent-widget-container.dark-mode .agent-widget-attach-button:hover {
  border-color: var(--agent-widget-primary, #6366f1);
  color: var(--agent-widget-primary, #6366f1);
  background: rgba(99, 102, 241, 0.1);
}

/* ============================================================
 * A2UI blocks (chart / mermaid / pending placeholder)
 * Rendered into <div data-a2ui-lang> mounts by renderA2UIBlocks().
 * ============================================================ */
.agent-widget-a2ui {
  margin: 12px 0;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  overflow: auto;
  max-width: 100%;
}
.agent-widget-a2ui-mermaid {
  display: flex;
  justify-content: center;
}
.agent-widget-a2ui svg {
  max-width: 100%;
  height: auto;
}
.agent-widget-a2ui-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}
.agent-widget-a2ui-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--agent-widget-primary, #6366f1);
  animation: agent-widget-a2ui-pulse 1.2s ease-in-out infinite;
}
@keyframes agent-widget-a2ui-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1.0; transform: scale(1.0); }
}
.agent-widget-a2ui-error {
  padding: 8px 12px;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
}
.agent-widget-a2ui-source {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 11px;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-widget-container.dark-mode .agent-widget-a2ui {
  background: #1e293b;
  border-color: #334155;
}
.agent-widget-container.dark-mode .agent-widget-a2ui-error {
  background: #2a1010;
  color: #fca5a5;
}
.agent-widget-container.dark-mode .agent-widget-a2ui-source {
  background: #0f172a;
  color: #cbd5e1;
}

/* ============================================================
 * Mermaid contrast overrides — same logic as the main app's
 * .mermaid-rendered overrides, scoped to the widget's mount points.
 * ============================================================ */
.agent-widget-a2ui-mermaid svg {
  max-width: 100%;
  height: auto;
}
.agent-widget-a2ui-mermaid svg .node:not(.statediagram-cluster) foreignObject .nodeLabel,
.agent-widget-a2ui-mermaid svg .node:not(.statediagram-cluster) foreignObject .nodeLabel * {
  color: #ffffff !important;
}
.agent-widget-a2ui-mermaid svg .node:not(.statediagram-cluster) text {
  fill: #ffffff !important;
}
.agent-widget-a2ui-mermaid svg .actor-man text,
.agent-widget-a2ui-mermaid svg text.actor {
  fill: #ffffff !important;
}
.agent-widget-a2ui-mermaid svg .mindmap-node[class*="section-1"] foreignObject .nodeLabel,
.agent-widget-a2ui-mermaid svg .mindmap-node[class*="section-2"] foreignObject .nodeLabel,
.agent-widget-a2ui-mermaid svg .mindmap-node[class*="section-3"] foreignObject .nodeLabel {
  color: #1e293b !important;
}


/*# sourceMappingURL=agent-widget.css.map*/