/* AI Chat Styles */
.ai-chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #ffbd33, #f0a400);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 189, 51, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #1c2020;
  transition: all 0.3s ease;
  z-index: 1000;
}

.ai-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 189, 51, 0.5);
}

.ai-chat-modal {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: #262c2c;
  border: 1px solid rgba(255, 189, 51, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-modal.show {
  display: flex;
}

.ai-chat-header {
  background: #343a40;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 189, 51, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-title {
  color: #ffbd33;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.ai-chat-close {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.ai-chat-close:hover {
  color: #ffbd33;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  scrollbar-width: thin;
  scrollbar-color: #ffbd33 #343a40;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: #343a40;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #ffbd33;
  border-radius: 3px;
}

.ai-chat-message {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

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

.ai-chat-message.ai {
  align-items: flex-start;
}

.ai-chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
}

.ai-chat-welcome {
  max-width: 280px;
}

.ai-chat-welcome-icon {
  font-size: 32px;
  color: #ffbd33;
  margin-bottom: 12px;
  opacity: 0.8;
}

.ai-chat-welcome-title {
  color: #ffbd33;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.ai-chat-welcome-text {
  color: #b0b8c1;
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 20px 0;
}

.ai-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-suggestion-pill {
  background: rgba(255, 189, 51, 0.1);
  border: 1px solid rgba(255, 189, 51, 0.2);
  border-radius: 20px;
  color: #ffbd33;
  cursor: pointer;
  font-size: 13px;
  padding: 8px 12px;
  text-align: left;
  transition: all 0.3s ease;
  width: 100%;
}

.ai-suggestion-pill:hover {
  background: rgba(255, 189, 51, 0.15);
  border-color: rgba(255, 189, 51, 0.4);
  transform: translateY(-1px);
}

.ai-suggestion-pill:active {
  transform: translateY(0);
}

.ai-message-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  word-wrap: break-word;
  position: relative;
  word-break: break-word;
  hyphens: auto;
}

.ai-message-bubble.user {
  background: #ffbd33;
  color: #1c2020;
  border-bottom-right-radius: 4px;
}

.ai-message-bubble.ai {
  background: #484f60;
  color: #ffffff;
  border-bottom-left-radius: 4px;
}

/* Markdown Styling for AI Messages */
.ai-message-bubble h1,
.ai-message-bubble h2,
.ai-message-bubble h3,
.ai-message-bubble h4,
.ai-message-bubble h5,
.ai-message-bubble h6 {
  margin: 0.5em 0 0.3em 0;
  line-height: 1.3;
  font-weight: 600;
}

.ai-message-bubble h1 { font-size: 1.4em; }
.ai-message-bubble h2 { font-size: 1.3em; }
.ai-message-bubble h3 { font-size: 1.2em; }
.ai-message-bubble h4 { font-size: 1.1em; }
.ai-message-bubble h5 { font-size: 1em; }
.ai-message-bubble h6 { font-size: 0.9em; }

.ai-message-bubble p {
  margin: 0.5em 0;
  line-height: 1.4;
}

.ai-message-bubble p:first-child {
  margin-top: 0;
}

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

.ai-message-bubble code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Courier New', Courier, monospace;
  color: #ffbd33;
}

.ai-message-bubble.user code {
  background: rgba(0, 0, 0, 0.15);
  color: #1c2020;
}

.ai-message-bubble pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 6px;
  margin: 0.5em 0;
  overflow-x: auto;
  border-left: 3px solid #ffbd33;
}

.ai-message-bubble.user pre {
  background: rgba(0, 0, 0, 0.2);
  border-left-color: #1c2020;
}

.ai-message-bubble pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85em;
  line-height: 1.4;
}

.ai-message-bubble ul,
.ai-message-bubble ol {
  margin: 0.5em 0;
  padding-left: 1.2em;
}

.ai-message-bubble li {
  margin: 0.2em 0;
  line-height: 1.4;
}

.ai-message-bubble a {
  color: #ffbd33;
  text-decoration: underline;
  text-decoration-color: rgba(255, 189, 51, 0.5);
  transition: all 0.2s ease;
}

.ai-message-bubble.user a {
  color: #1c2020;
  text-decoration-color: rgba(28, 32, 32, 0.5);
}

.ai-message-bubble a:hover {
  text-decoration-color: currentColor;
  opacity: 0.8;
}

.ai-message-bubble blockquote {
  margin: 0.5em 0;
  padding: 8px 12px;
  border-left: 3px solid #ffbd33;
  background: rgba(255, 189, 51, 0.1);
  font-style: italic;
}

.ai-message-bubble.user blockquote {
  border-left-color: #1c2020;
  background: rgba(28, 32, 32, 0.1);
}

.ai-message-bubble table {
  border-collapse: collapse;
  margin: 0.5em 0;
  width: 100%;
  font-size: 0.9em;
}

.ai-message-bubble th,
.ai-message-bubble td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  text-align: left;
}

.ai-message-bubble.user th,
.ai-message-bubble.user td {
  border-color: rgba(28, 32, 32, 0.2);
}

.ai-message-bubble th {
  background: rgba(255, 189, 51, 0.2);
  font-weight: 600;
}

.ai-message-bubble.user th {
  background: rgba(28, 32, 32, 0.2);
}

.ai-message-bubble hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  margin: 1em 0;
}

.ai-message-bubble.user hr {
  border-top-color: rgba(28, 32, 32, 0.3);
}

.ai-message-bubble strong {
  font-weight: 600;
}

.ai-message-bubble em {
  font-style: italic;
}

.ai-message-bubble del {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Task Lists */
.ai-message-bubble .task-list-item {
  list-style: none;
  margin-left: -1.2em;
  padding-left: 1.2em;
}

.ai-message-bubble .task-list-item input[type="checkbox"] {
  margin-right: 0.5em;
  pointer-events: none;
}

/* Enhanced code blocks with syntax highlighting placeholder */
.ai-message-bubble pre[class*="language-"] {
  position: relative;
}

.ai-message-bubble pre[class*="language-"]::before {
  content: attr(class);
  position: absolute;
  top: 2px;
  right: 6px;
  font-size: 0.7em;
  color: rgba(255, 189, 51, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-message-bubble.user pre[class*="language-"]::before {
  color: rgba(28, 32, 32, 0.6);
}

/* Better spacing for nested lists */
.ai-message-bubble li ul,
.ai-message-bubble li ol {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}

/* Special styling for inline math (if using MathJax later) */
.ai-message-bubble .math-inline {
  background: rgba(255, 189, 51, 0.1);
  padding: 1px 3px;
  border-radius: 2px;
}

.ai-message-bubble.user .math-inline {
  background: rgba(28, 32, 32, 0.1);
}

.ai-message-time {
  font-size: 11px;
  color: #6c757d;
  margin-top: 4px;
  margin-bottom: 0;
}

.ai-chat-input-container {
  padding: 15px;
  border-top: 1px solid rgba(255, 189, 51, 0.2);
  display: flex;
  gap: 10px;
}

.ai-chat-input {
  flex: 1;
  background: #343a40;
  border: 1px solid rgba(255, 189, 51, 0.3);
  border-radius: 20px;
  padding: 10px 15px;
  color: #ffffff;
  font-size: 14px;
  resize: none;
  min-height: 20px;
  max-height: 80px;
  outline: none;
  transition: border-color 0.3s ease;
}

.ai-chat-input:focus {
  border-color: #ffbd33;
  box-shadow: 0 0 0 0.1rem rgba(255, 189, 51, 0.25);
}

.ai-chat-input::placeholder {
  color: #6c757d;
}

.ai-chat-send {
  background: #ffbd33;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c2020;
  font-size: 16px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
  background: #f0a400;
  transform: scale(1.05);
}

.ai-chat-send:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
}

.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6c757d;
  font-style: italic;
  font-size: 14px;
}

.ai-typing-dots {
  display: flex;
  gap: 3px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #6c757d;
  border-radius: 50%;
  animation: typing-pulse 1.4s infinite ease-in-out;
}

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

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

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

/* Mobile responsiveness */
@media (max-width: 480px) {
  .ai-chat-modal {
    width: calc(100vw - 40px);
    height: 60vh;
    max-height: 500px;
  }

  .ai-chat-button {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .ai-chat-empty-state {
    padding: 15px;
  }

  .ai-chat-welcome {
    max-width: 100%;
  }

  .ai-chat-welcome-icon {
    font-size: 28px;
  }

  .ai-chat-welcome-title {
    font-size: 16px;
  }

  .ai-chat-welcome-text {
    font-size: 13px;
  }

  .ai-suggestion-pill {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Tool Usage Indicator */
.ai-tool-usage-indicator {
  display: flex;
  justify-content: center;
  margin: 10px 0 5px 0;
  opacity: 0.8;
}

.ai-tool-indicator {
  background: rgba(255, 189, 51, 0.1);
  border: 1px solid rgba(255, 189, 51, 0.2);
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #ffbd33;
}

.ai-tool-icon {
  font-size: 14px;
  filter: brightness(1.1);
}

.ai-tool-indicator small {
  font-size: 11px;
  color: #b0b8c1;
  margin: 0;
}
