/* Airbrx Assistant - Collapsible Side Panel */

/* Body transition for content push */
body {
  transition: margin-right 0.3s ease;
}

body.chatbot-open {
  margin-right: 400px;
}

/* Adjust modals when chatbot is open */
body.chatbot-open .modal-overlay {
  right: 400px;
  left: 0;
  width: auto;
}

body.chatbot-open .confirm-modal-overlay {
  right: 400px;
  left: 0;
  width: auto;
}

/* Toggle Button - Fixed position at right side */
.chatbot-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 48px;
  height: 120px;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff8c42 100%);
  border: none;
  box-shadow: -2px 0 8px rgba(253,108,29,0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  z-index: 3500;
  padding: 12px 8px;
}

.chatbot-toggle:hover {
  width: 52px;
  box-shadow: -4px 0 16px rgba(253,108,29,0.4);
}

.chatbot-toggle.open {
  right: 400px;
}

.chatbot-toggle-icon {
  writing-mode: vertical-rl;
  transform: rotate(90deg);  /* Add this line */
  font-size: 24px;
  color: white;
}

.chatbot-toggle-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  font-weight: 700;
  color: white;
  letter-spacing: 1px;
}

/* Side Panel Container */
.chatbot-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: #1e1e1e;
  border-left: 2px solid #333;
  display: flex;
  flex-direction: column;
  z-index: 3400;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.chatbot-panel.open {
  right: 0;
}

/* Panel Header - Code Editor Style */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #252526;
  border-bottom: 1px solid #333;
}

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

.chatbot-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-control-btn {
  background: none;
  border: none;
  color: #858585;
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.chatbot-control-btn:hover {
  background: #333;
  color: #d4d4d4;
}

.chatbot-control-btn:active {
  background: #3e3e42;
}

.chatbot-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e1e1e;
  padding: 6px 12px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #333;
  border-bottom: none;
}

.chatbot-tab-icon {
  font-size: 14px;
  color: var(--accent);
}

.chatbot-title {
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d4;
  margin: 0;
  font-family: 'Courier New', monospace;
}

.chatbot-status {
  font-size: 11px;
  color: #858585;
  font-family: 'Courier New', monospace;
}

.chatbot-close {
  background: none;
  border: none;
  color: #858585;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.chatbot-close:hover {
  background: #333;
  color: #d4d4d4;
}

/* Messages Container - Terminal Style */
.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #1e1e1e;
  font-family: 'Courier New', monospace;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.chatbot-messages::-webkit-scrollbar {
  width: 10px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #252526;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #3e3e42;
  border-radius: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #4e4e52;
}

/* Message Bubbles - Code Block Style */
.message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: messageSlideIn 0.3s ease-out;
}

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

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #858585;
}

.message-header-icon {
  font-size: 12px;
}

.message-header.user-header {
  color: #4ec9b0;
}

.message-header.user-header .message-header-icon {
  color: #4ec9b0;
}

.message-header.bot-header {
  color: var(--accent);
}

.message-header.bot-header .message-header-icon {
  color: var(--accent);
}

.message-content {
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.6;
  border-left: 3px solid;
}

.message.user-message .message-content {
  background: #2d2d30;
  color: #d4d4d4;
  border-left-color: #4ec9b0;
}

.message.bot-message .message-content {
  background: #252526;
  color: #d4d4d4;
  border-left-color: var(--accent);
}

/* Page Context Banner */
.page-context {
  background: #264f78;
  color: #d4d4d4;
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid #333;
  font-family: 'Courier New', monospace;
}

.page-context-label {
  color: #9cdcfe;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-context-desc {
  color: #d4d4d4;
}

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

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingDot 1.4s ease-in-out infinite;
}

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

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

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Input Container - Command Line Style */
.chatbot-input-container {
  padding: 16px;
  border-top: 1px solid #333;
  background: #252526;
}

.chatbot-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  padding: 2px;
}

.chatbot-input-prompt {
  padding: 0 8px;
  color: var(--accent);
  font-weight: 700;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.chatbot-input {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: #d4d4d4;
}

.chatbot-input:focus {
  outline: none;
}

.chatbot-input::placeholder {
  color: #858585;
  font-style: italic;
}

.chatbot-send {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
  background: #e55f15;
}

.chatbot-send:disabled {
  background: #3e3e42;
  cursor: not-allowed;
}

.chatbot-send i {
  font-size: 14px;
  color: white;
}

/* Status Bar at Bottom */
.chatbot-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px;
  background: #007acc;
  font-size: 11px;
  color: white;
  font-family: 'Courier New', monospace;
}

.statusbar-left,
.statusbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.statusbar-icon {
  font-size: 10px;
}

/* Responsive Design */
/* When screen is too narrow for side-by-side (less than 1000px), switch to overlay mode */
@media (max-width: 1000px) {
  /* Disable content push on smaller screens */
  body.chatbot-open {
    margin-right: 0;
  }

  .chatbot-panel {
    width: 400px;
    right: -400px;
  }

  .chatbot-panel.open {
    right: 0;
  }

  .chatbot-toggle.open {
    right: 400px;
  }
}

/* Mobile/tablet - full width overlay */
@media (max-width: 768px) {
  .chatbot-panel {
    width: 100%;
    right: -100%;
  }

  .chatbot-panel.open {
    right: 0;
  }

  .chatbot-toggle.open {
    right: 0;
    opacity: 0;
    pointer-events: none;
  }
}

/* Dark Scrollbar for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #3e3e42 #252526;
}

/* Markdown Formatting in Bot Messages */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  color: #4ec9b0;
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 700;
}

.message-content h1 {
  font-size: 18px;
  border-bottom: 1px solid #3e3e42;
  padding-bottom: 4px;
}

.message-content h2 {
  font-size: 16px;
}

.message-content h3 {
  font-size: 14px;
}

.message-content h4 {
  font-size: 13px;
}

.message-content p {
  margin: 8px 0;
}

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

.message-content li {
  margin: 4px 0;
}

.message-content code {
  background: #1e1e1e;
  color: #ce9178;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.message-content pre {
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-content pre code {
  background: none;
  padding: 0;
  color: #d4d4d4;
  font-size: 12px;
  line-height: 1.5;
}

.message-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 12px 0;
  color: #9cdcfe;
  font-style: italic;
}

.message-content a {
  color: #4ec9b0;
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

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

.message-content table th,
.message-content table td {
  border: 1px solid #3e3e42;
  padding: 6px 8px;
  text-align: left;
}

.message-content table th {
  background: #2d2d30;
  color: #4ec9b0;
  font-weight: 700;
}

.message-content table tr:nth-child(even) {
  background: #2d2d30;
}

.message-content hr {
  border: none;
  border-top: 1px solid #3e3e42;
  margin: 16px 0;
}

.message-content strong {
  color: #dcdcaa;
  font-weight: 700;
}

.message-content em {
  color: #9cdcfe;
  font-style: italic;
}
