/* copilot.css - Floating AI Director Copilot Widget (shadcn/ui style) */

/* Nút trigger nổi (Floating Trigger Button) */
.copilot-trigger-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(12px);
}

.copilot-trigger-btn:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 14px 30px -5px rgba(99, 102, 241, 0.3);
}

.copilot-trigger-icon {
  font-size: 18px;
  animation: pulse-claw 2s infinite ease-in-out;
}

@keyframes pulse-claw {
  0% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1); }
}

.copilot-trigger-badge {
  background: #10b981;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

/* Chatbot Floating Dialog Box */
.copilot-dialog {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 9999;
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 110px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
  transform: translateY(0) scale(1);
  backdrop-filter: blur(16px);
}

.copilot-dialog.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

/* Dialog Header */
.copilot-header {
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.copilot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.copilot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.copilot-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.copilot-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
}

.copilot-status {
  font-size: 11px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 5px;
}

.copilot-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 4px #10b981;
}

.copilot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-btn-icon {
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s;
}

.copilot-btn-icon:hover {
  background: var(--secondary);
  color: var(--foreground);
}

/* Chat Messages Container */
.copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.copilot-msg {
  display: flex;
  gap: 10px;
  max-width: 92%;
  animation: msgFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.copilot-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.copilot-msg.assistant {
  align-self: flex-start;
}

.copilot-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.copilot-msg.user .copilot-msg-bubble {
  background: var(--primary);
  color: var(--primary-foreground);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.copilot-msg.assistant .copilot-msg-bubble {
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Markdown styling inside assistant bubble */
.copilot-msg-bubble p {
  margin-bottom: 8px;
}
.copilot-msg-bubble p:last-child {
  margin-bottom: 0;
}
.copilot-msg-bubble ul, .copilot-msg-bubble ol {
  margin-left: 18px;
  margin-bottom: 8px;
}
.copilot-msg-bubble li {
  margin-bottom: 4px;
}
.copilot-msg-bubble strong {
  font-weight: 700;
  color: var(--foreground);
}
.copilot-msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.copilot-msg-bubble th, .copilot-msg-bubble td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}
.copilot-msg-bubble th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}
.copilot-msg-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

/* Quick Action Suggestion Chips */
.copilot-chips-wrap {
  padding: 8px 14px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.copilot-chips-wrap::-webkit-scrollbar {
  display: none;
}

.copilot-chip {
  padding: 5px 10px;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.copilot-chip:hover {
  background: var(--accent);
  color: var(--foreground);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Input Area */
.copilot-input-area {
  padding: 12px 14px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.copilot-input {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input);
  background: var(--background);
  color: var(--foreground);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.copilot-input:focus {
  border-color: var(--ring);
}

.copilot-send-btn {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

.copilot-send-btn:hover {
  opacity: 0.9;
}

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

/* Typing Indicator */
.copilot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--secondary);
  border-radius: var(--radius-lg);
  width: fit-content;
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Responsive Mobile for Copilot */
@media (max-width: 768px) {
  .copilot-trigger-btn {
    bottom: 16px;
    right: 16px;
    padding: 8px 14px 8px 10px;
    font-size: 12px;
  }
  .copilot-dialog {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-bottom: none;
  }
}
