/* ==========================================================================
   CROWNATE AI — ENTERPRISE ASSISTANT UI WIDGET
   Design: High-Contrast European Minimalist Obsidian & Warm Gold System
   Accessibility: WCAG 2.2 AA Compliant
   ========================================================================== */

/* 1. Floating Trigger Launcher Badge */
.crownate-ai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-modal, 3000);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: #0c0d10;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 9999px;
  color: #ffffff;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 175, 55, 0.15);
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.crownate-ai-launcher:hover {
  transform: translateY(-2px);
  border-color: #d4af37;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(212, 175, 55, 0.3);
}

.crownate-ai-launcher:focus-visible {
  outline: 2px solid #d4af37;
  outline-offset: 3px;
}

.launcher-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.launcher-badge-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #d4af37;
  text-transform: uppercase;
}

/* 2. Slide-out Enterprise Panel */
.crownate-ai-panel {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: min(440px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 120px));
  background: #08090c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal, 3000);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: all 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.crownate-ai-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Panel Header */
.ai-panel-header {
  padding: 16px 20px;
  background: #111317;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-header-title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1em;
}

.ai-header-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #d4af37;
  text-transform: uppercase;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-icon-btn {
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, background 150ms;
}

.ai-icon-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ai-icon-btn.active {
  color: #d4af37;
}

/* Messages Scrollable Area */
.ai-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.ai-messages-container::-webkit-scrollbar {
  width: 5px;
}

.ai-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Message Bubbles */
.ai-message {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  animation: msgFadeIn 250ms ease-out forwards;
}

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

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

.ai-message.agent {
  align-self: flex-start;
}

.ai-message-bubble {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.ai-message.user .ai-message-bubble {
  background: #ffffff;
  color: #060709;
  font-weight: 500;
  border-bottom-right-radius: 2px;
}

.ai-message.agent .ai-message-bubble {
  background: #14171d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e9ecef;
  border-bottom-left-radius: 2px;
}

.ai-message.agent .direct-answer {
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.ai-message.agent .explanation {
  color: #ced4da;
  margin-bottom: 8px;
}

.ai-message.agent .next-step-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #d4af37;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 0 4px;
}

.ai-timestamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #6c757d;
}

.ai-feedback-btns {
  display: flex;
  gap: 4px;
}

.feedback-btn {
  background: transparent;
  border: none;
  color: #6c757d;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: color 150ms;
}

.feedback-btn:hover {
  color: #ffffff;
}

.feedback-btn.selected {
  color: #34d399;
}

/* Quick Suggestion Chips */
.ai-suggestions-tray {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(12, 13, 16, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.ai-suggestions-tray::-webkit-scrollbar {
  display: none;
}

.ai-prompt-chip {
  flex: 0 0 auto;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  color: #ced4da;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
}

.ai-prompt-chip:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.4);
  color: #ffffff;
}

/* Typing & Input Bar */
.ai-input-bar {
  padding: 14px 16px;
  background: #111317;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-text-input {
  flex: 1;
  background: #08090c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 150ms;
}

.ai-text-input:focus {
  border-color: #d4af37;
}

.ai-send-btn {
  background: #ffffff;
  color: #060709;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, transform 150ms;
}

.ai-send-btn:hover {
  background: #e9ecef;
  transform: scale(1.02);
}

.ai-mic-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #adb5bd;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms;
}

.ai-mic-btn.listening {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* In-Message Action Buttons */
.ai-action-btn-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-action-btn {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid #d4af37;
  color: #ffffff;
  border-radius: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 150ms;
}

.ai-action-btn:hover {
  background: #d4af37;
  color: #060709;
}

/* Mobile Layout Safe Rules */
@media (max-width: 600px) {
  .crownate-ai-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .crownate-ai-launcher {
    bottom: 16px;
    right: 16px;
    padding: 8px 14px;
  }
}
