/* Modern Chat Status System
   ========================
   A sophisticated, minimal approach to chat status indicators
*/

:root {
  /* Status System Colors - Light Mode */
  --status-bg: #f8f9fa;
  --status-bg-hover: #f3f4f6;
  --status-text: #4b5563;
  --status-accent: var(--color-primary, #e3175e);
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-info: #3b82f6;
  --status-border: #e5e7eb;
  --status-shadow: rgba(0, 0, 0, 0.04);
  --status-shadow-hover: rgba(0, 0, 0, 0.08);
  
  /* Animation Timings */
  --status-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --status-fade-in: 300ms cubic-bezier(0, 0, 0.2, 1);
  --status-slide: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 1. Inline Status Bar - Minimal, Always Visible */
.chat-status-bar {
  position: fixed;
  bottom: 120px; /* Above input area */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f8f9fa !important; /* Direct color with !important */
  border: 1px solid #e5e7eb !important;
  backdrop-filter: blur(10px);
  border-radius: 24px;
  font-size: 13px;
  color: #4b5563 !important;
  max-width: 90%;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--status-transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
}

/* Ensure light mode colors */
body:not(.dark-mode) .chat-status-bar {
  background: #f8f9fa !important;
  color: #4b5563 !important;
  border-color: #e5e7eb !important;
}

.chat-status-bar.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.chat-status-bar:hover {
  background: #f3f4f6 !important;
}

.dark-mode .chat-status-bar:hover {
  background: #252529 !important;
}

.chat-status-bar .status-text {
  font-weight: 500;
  letter-spacing: -0.01em;
  color: inherit !important;
}

.chat-status-bar.sliding-up {
  animation: statusSlideUp var(--status-slide) forwards;
}

/* 2. Status Icon - Elegant Activity Indicator */
.status-icon {
  width: 16px;
  height: 16px;
  position: relative;
}

.status-icon.typing::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #4b5563 !important;
  border-radius: 50%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  animation: typingDot 1.4s infinite;
  opacity: 0.6;
}

.dark-mode .status-icon.typing::before {
  background: #9ca3af !important;
}

.status-icon.typing::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #4b5563 !important;
  border-radius: 50%;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  animation: typingDot 1.4s infinite 0.2s;
  opacity: 0.6;
}

.dark-mode .status-icon.typing::after {
  background: #9ca3af !important;
}

.status-icon.typing span {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #4b5563 !important;
  border-radius: 50%;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  animation: typingDot 1.4s infinite 0.4s;
  opacity: 0.6;
}

.dark-mode .status-icon.typing span {
  background: #9ca3af !important;
}

/* Tool Activity - Rotating Circle */
.status-icon.tool {
  animation: gentleSpin 2s linear infinite;
}

.status-icon.tool svg {
  width: 16px;
  height: 16px;
  stroke: var(--status-accent);
  stroke-width: 2;
  fill: none;
}

/* 3. Floating Status Pills - For Active Tools */
.floating-status-container {
  position: fixed;
  right: 20px;
  bottom: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  z-index: 99;
  background: transparent !important; /* Ensure container has no background */
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f8f9fa !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  font-size: 13px;
  color: #4b5563 !important;
  animation: pillSlideIn var(--status-slide) backwards;
  transition: all var(--status-transition);
  cursor: pointer;
}

/* Dark mode status pill */
.dark-mode .status-pill {
  background: #1e1e23 !important;
  color: #9ca3af !important;
  border-color: #2d2d35 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.status-pill:hover {
  transform: translateX(-2px);
  background: #f3f4f6 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.dark-mode .status-pill:hover {
  background: #252529 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.status-pill-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent !important;
  color: inherit !important;
}

.status-pill-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: -0.01em;
  background: transparent !important;
  color: inherit !important;
}

.status-pill-close {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent !important;
  cursor: pointer;
  opacity: 0.5;
  transition: all var(--status-transition);
  font-size: 12px;
  line-height: 1;
  color: inherit !important;
}

.status-pill-close:hover {
  opacity: 0.8;
  background: var(--status-bg-hover);
}

/* 4. Message Annotations - Subtle Tool Indicators */
.message-status-annotation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--status-bg);
  border: 1px solid var(--status-border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--status-text);
  opacity: 0.8;
  transition: all var(--status-transition);
}

.message-status-annotation:hover {
  opacity: 1;
  background: var(--status-bg-hover);
}

/* Status Bubble Content - For legacy status manager */
.status-bubble .status-bubble-content,
.message-bubble.status-bubble-content,
.status-bubble .message-bubble,
#status-typing-indicator .message-bubble,
#status-inline .message-bubble {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 16px !important;
  background: #f8f9fa !important; /* Direct color to avoid CSS variable conflicts */
  color: #4b5563 !important; /* Direct color */
  font-size: 13px !important;
  border-radius: 18px 18px 18px 4px !important;
  margin-left: 0 !important;
  max-width: fit-content !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

/* Dark mode override for status bubbles */
.dark-mode .status-bubble .status-bubble-content,
.dark-mode .message-bubble.status-bubble-content,
.dark-mode .status-bubble .message-bubble,
.dark-mode #status-typing-indicator .message-bubble,
.dark-mode #status-inline .message-bubble {
  background: #1e1e23 !important;
  color: #9ca3af !important;
  border-color: #2d2d35 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.status-bubble .css-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--status-border);
  border-top-color: var(--status-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Override any status bubble with dark backgrounds */
.message-container.status-bubble .message-bubble[style*="background"] {
  background: #f8f9fa !important;
}

.dark-mode .message-container.status-bubble .message-bubble[style*="background"] {
  background: #1e1e23 !important;
}

/* Ensure status text has proper color */
.status-bubble .msg,
.status-bubble .message-text,
.status-bubble-content .msg {
  color: #4b5563 !important;
}

.dark-mode .status-bubble .msg,
.dark-mode .status-bubble .message-text,
.dark-mode .status-bubble-content .msg {
  color: #9ca3af !important;
}

/* 5. Status Dot Indicator - Ultra Minimal */
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--status-text);
  display: inline-block;
  animation: pulse 2s infinite;
  opacity: 0.6;
}

.status-dot.success {
  background: var(--status-success);
  opacity: 0.7;
}

.status-dot.warning {
  background: var(--status-warning);
  opacity: 0.7;
}



/* Animations */
@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(-50%) scale(0.9);
  }
  30% {
    opacity: 0.8;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes gentleSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes statusSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-status-bar {
    bottom: 100px;
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .floating-status-container {
    right: 10px;
    bottom: 120px;
    max-width: 240px;
  }
  
  .status-pill {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Dark Mode Support */
.dark-mode {
  --status-bg: #1e1e23;
  --status-bg-hover: #252529;
  --status-text: #9ca3af;
  --status-border: #2d2d35;
  --status-shadow: rgba(0, 0, 0, 0.2);
  --status-shadow-hover: rgba(0, 0, 0, 0.3);
}

/* Dark mode chat status bar */
.dark-mode .chat-status-bar {
  background: #1e1e23 !important;
  color: #9ca3af !important;
  border-color: #2d2d35 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.dark-mode .status-pill-close:hover {
  background: var(--status-bg-hover);
}

@media (prefers-color-scheme: dark) {
  :root {
    --status-bg: #1e1e23;
    --status-bg-hover: #252529;
    --status-text: #9ca3af;
    --status-border: #2d2d35;
    --status-shadow: rgba(0, 0, 0, 0.2);
    --status-shadow-hover: rgba(0, 0, 0, 0.3);
  }
  
  .status-pill-close:hover {
    background: var(--status-bg-hover);
  }
}

/* Final overrides to ensure correct colors */
.chat-status-bar[style*="background"] {
  background: #f8f9fa !important;
}

body:not(.dark-mode) .chat-status-bar[style*="background: #000"],
body:not(.dark-mode) .chat-status-bar[style*="background: black"],
body:not(.dark-mode) .chat-status-bar[style*="background:black"],
body:not(.dark-mode) .chat-status-bar[style*="background:#000"] {
  background: #f8f9fa !important;
}

.dark-mode .chat-status-bar[style*="background"] {
  background: #1e1e23 !important;
}

/* Ultra-specific override for any black backgrounds */
body .chat-status-bar,
html body .chat-status-bar,
html body:not(.dark-mode) .chat-status-bar {
  background-color: #f8f9fa !important;
  background: #f8f9fa !important;
}

html body.dark-mode .chat-status-bar {
  background-color: #1e1e23 !important;
  background: #1e1e23 !important;
}

/* Final catch-all with ID selector for maximum specificity */
#root .chat-status-bar,
#app .chat-status-bar,
div.chat-status-bar {
  background: #f8f9fa !important;
  background-color: #f8f9fa !important;
}

.dark-mode #root .chat-status-bar,
.dark-mode #app .chat-status-bar,
.dark-mode div.chat-status-bar {
  background: #1e1e23 !important;
  background-color: #1e1e23 !important;
}

/* Ultra-specific overrides for status pills */
.floating-status-container .status-pill,
div.status-pill,
body .status-pill,
html body .status-pill {
  background: #f8f9fa !important;
  background-color: #f8f9fa !important;
}

.dark-mode .floating-status-container .status-pill,
.dark-mode div.status-pill,
.dark-mode body .status-pill,
html body.dark-mode .status-pill {
  background: #1e1e23 !important;
  background-color: #1e1e23 !important;
}

/* Ensure status pill text colors */
.status-pill .status-pill-text,
.status-pill-text {
  color: inherit !important;
}

/* Override any inline styles on status pills */
.status-pill[style*="background"] {
  background: #f8f9fa !important;
}

.dark-mode .status-pill[style*="background"] {
  background: #1e1e23 !important;
} 