/* ==========================================================================
   ODIN ENTERPRISE AI ASSISTANT - FLOATING DOCK & DRAWER STYLES
   ========================================================================== */

#odin-ai-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  transform: none;
  z-index: 9990;
  width: min(440px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* children re-enable pointer-events */
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans, 'Inter', sans-serif);
}

/* Collapsed state: dock shrinks down to only show the compact corner FAB */
#odin-ai-dock.collapsed {
  width: auto;
}

#odin-ai-dock.collapsed .odin-drawer {
  display: none !important;
}

#odin-ai-dock.collapsed .odin-input-bar {
  display: none !important;
}

#odin-ai-dock.collapsed .odin-fab-launcher {
  display: inline-flex !important;
}

#odin-ai-dock:not(.collapsed) .odin-fab-launcher {
  display: none !important;
}

#odin-ai-dock:not(.collapsed) .odin-input-bar {
  display: flex !important;
  width: 100%;
}

#odin-ai-dock:not(.collapsed) .odin-drawer {
  width: 100%;
}

/* Auto-yield: when any modal overlay is active, dim and disable dock clicks so form options are 100% accessible */
body:has(.modal-overlay:not(.hidden):not([style*="display: none"])) #odin-ai-dock {
  opacity: 0.12;
  pointer-events: none !important;
}

/* ==================== EXPANDABLE CHAT DRAWER ==================== */
.odin-drawer {
  pointer-events: auto;
  background: rgba(11, 19, 32, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-radius: 20px 20px 6px 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 30px rgba(0, 245, 196, 0.08);
  display: flex;
  flex-direction: column;
  max-height: 64vh;
  min-height: 280px;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  margin-bottom: 2px;
}

.odin-drawer.collapsed {
  display: none !important;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

/* Header */
.odin-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
}

.odin-drawer-header:active {
  cursor: grabbing;
}

.odin-brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.odin-cosmic-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: conic-gradient(from 180deg at 50% 50%, #ff5a36, #ffc53d, #7c5cff, #00f5c4, #ff5a36);
  box-shadow: 0 0 12px rgba(255, 90, 54, 0.4);
  position: relative;
  animation: odin-spin 12s linear infinite;
  flex-shrink: 0;
}

.odin-cosmic-icon::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  background: #0b1320;
  border-radius: 50%;
}

@keyframes odin-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.odin-brand-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.odin-model-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.4);
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

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

.odin-btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.odin-btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Suggestions Strip */
.odin-suggestions-strip {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(15, 23, 42, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.odin-suggestions-strip::-webkit-scrollbar {
  display: none;
}

.odin-suggestion-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.odin-suggestion-chip:hover {
  background: rgba(0, 245, 196, 0.12);
  border-color: rgba(0, 245, 196, 0.35);
  color: #00f5c4;
}

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

.odin-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: odin-fade-in 0.2s ease forwards;
}

.odin-msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.odin-msg-row.ai {
  align-self: flex-start;
  align-items: flex-start;
}

@keyframes odin-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.odin-msg-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.odin-msg-row.user .odin-msg-bubble {
  background: linear-gradient(135deg, #1e3a8a, #0284c7);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

.odin-msg-row.ai .odin-msg-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.odin-msg-meta {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

/* Thinking Process Collapsible Accordion */
.odin-thinking-bubble {
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.06);
  overflow: hidden;
}

.odin-thinking-header {
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: rgba(124, 92, 255, 0.1);
  color: #c4b5fd;
  font-size: 11.5px;
  font-weight: 600;
  user-select: none;
}

.odin-thinking-content {
  padding: 10px 12px;
  font-size: 11.5px;
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
  line-height: 1.5;
  white-space: pre-wrap;
  border-top: 1px solid rgba(124, 92, 255, 0.15);
  background: rgba(15, 23, 42, 0.4);
}

.odin-thinking-bubble.collapsed .odin-thinking-content {
  display: none;
}

/* Tool Execution Step Badge */
.odin-tool-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 245, 196, 0.08);
  border: 1px solid rgba(0, 245, 196, 0.25);
  color: #00f5c4;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  margin-bottom: 6px;
}

/* Human-in-the-Loop (HITL) Confirmation Card */
.odin-hitl-card {
  margin-top: 8px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.1);
}

.odin-hitl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fbbf24;
  font-size: 12.5px;
  font-weight: 700;
}

.odin-hitl-summary {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.45;
}

.odin-hitl-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 8px;
}

.odin-hitl-param-item {
  font-size: 11px;
  color: #94a3b8;
}

.odin-hitl-param-item strong {
  color: #cbd5e1;
}

.odin-hitl-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.odin-hitl-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.odin-hitl-btn-confirm {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
  transition: all 0.15s ease;
}

.odin-hitl-btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

/* History / Threads Panel */
.odin-history-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

.odin-history-panel.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.odin-thread-tile {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.odin-thread-tile:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 245, 196, 0.3);
}

.odin-thread-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.odin-thread-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.odin-thread-date {
  font-size: 10.5px;
  color: #64748b;
}

/* ==================== FLOATING INPUT BAR ==================== */
.odin-input-bar {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 245, 196, 0.1);
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.odin-input-bar:focus-within {
  border-color: rgba(0, 245, 196, 0.5);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 245, 196, 0.2);
}

.odin-input-cosmic-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.odin-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.4;
  resize: none;
  max-height: 110px;
  min-height: 24px;
  padding: 6px 0;
  font-family: inherit;
}

.odin-textarea::placeholder {
  color: #64748b;
}

.odin-input-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.odin-send-btn {
  background: linear-gradient(135deg, #00f5c4, #0284c7);
  border: none;
  color: #03151e;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 10px rgba(0, 245, 196, 0.3);
}

.odin-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 245, 196, 0.5);
}

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

/* Spinner */
.odin-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #00f5c4;
  border-radius: 50%;
  animation: odin-spin 0.8s linear infinite;
}

/* Attachment preview badge inside input bar */
.odin-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 11px;
}

.odin-attachment-chip button {
  background: none;
  border: none;
  color: #38bdf8;
  cursor: pointer;
  padding: 0;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  #odin-ai-dock {
    bottom: 12px;
    right: 12px;
    width: calc(100vw - 24px);
  }
  .odin-drawer {
    max-height: 75vh;
  }
  .odin-suggestions-strip {
    padding: 8px 12px;
  }
}

/* ==================== COMPACT FAB LAUNCHER ==================== */
.odin-fab-launcher {
  pointer-events: auto;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 12px;
  background: rgba(11, 19, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 245, 196, 0.45);
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 245, 196, 0.25);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.odin-fab-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65), 0 0 30px rgba(0, 245, 196, 0.45);
  border-color: rgba(0, 245, 196, 0.8);
}

.odin-fab-text {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.odin-fab-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.2);
  border: 1px solid rgba(124, 92, 255, 0.4);
  color: #c4b5fd;
  text-transform: uppercase;
}
