/* Loading Messages - TASK-005b */

/* Enhanced loading overlay with messages */
#loading-overlay {
  background-color: rgba(0, 0, 0, 0.8);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loading-message {
  color: white;
  font-size: 1.1rem;
  text-align: center;
  min-height: 2rem;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  max-width: 400px;
  padding: 0 1rem;
}

.loading-message.active {
  opacity: 1;
}

/* Contextual loading for interactions: one line inside the action bar, between
   the mode pills and Send, so a running turn never adds a row, covers the
   textarea, or shrink-wraps Cancel. */
.pending-row {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.pending-status {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted, #b9b3d6);
  font-size: 0.85rem;
}
.pending-status:empty {
  display: none;
}
/* The rotating pill gives way before the status line, which names the mode. */
#loading-spinner {
  display: flex;
  flex: 0 100 auto;
  min-width: 0;
  background: rgba(15, 10, 25, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(130, 80, 200, 0.3);
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

#loading-spinner .spinner-border {
  flex: none;
}

#loading-spinner .loading-message {
  color: #e2d9f3;
  margin-top: 0;
  min-height: 0;
  max-width: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
  letter-spacing: 0.2px;
}

/* Phone: the pills fill the bar, so a running turn's status takes their slot. */
@media (max-width: 767.98px) {
  .pending-row {
    display: none;
  }
  .turn-running .pending-row {
    display: flex;
    flex: 1 1 auto;
    /* The pill group's height: 44px pills inside its 1px border. */
    min-height: 46px;
  }
  .turn-running .toggle-group {
    display: none;
  }
}


/* Animation for message rotation */
@keyframes fadeInOut {

  0%,
  100% {
    opacity: 0;
  }

  20%,
  80% {
    opacity: 1;
  }
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .loading-message {
    font-size: 1rem;
    max-width: 300px;
  }
}