/* SkyBots AI floating assistant */

.server-ai-floating {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  pointer-events: none;
}

.server-ai-launcher {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.24);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.server-ai-launcher:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.3);
}

.server-ai-launcher svg {
  width: 22px;
  height: 22px;
}

.server-ai-window {
  width: min(448px, calc(100vw - 32px));
  max-height: min(690px, calc(100vh - 108px));
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  overflow: hidden;
  pointer-events: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.server-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.server-ai-title-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.server-ai-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-muted);
  color: var(--accent);
}

.server-ai-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.server-ai-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.server-ai-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.server-ai-close:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.server-ai-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  gap: 12px;
}

.server-ai-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.server-ai-quick-actions button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.server-ai-quick-actions button:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.server-ai-quick-actions button:disabled,
.server-ai-form button:disabled,
.server-ai-apply:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.server-ai-quick-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-muted);
  color: var(--accent);
}

.server-ai-quick-actions strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-ai-quick-actions small {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-ai-form button,
.server-ai-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.server-ai-form button:hover:not(:disabled),
.server-ai-apply:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.server-ai-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.server-ai-alert-error {
  background: var(--error-muted);
  color: var(--error);
}

.server-ai-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  max-height: 430px;
  min-height: 214px;
  overflow: auto;
  padding-right: 3px;
}

.server-ai-messages::-webkit-scrollbar {
  width: 8px;
}

.server-ai-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border-hover);
}

.server-ai-message {
  padding: 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

.server-ai-message-user {
  margin-left: 34px;
  border-color: var(--accent);
  background: var(--accent-muted);
}

.server-ai-message-assistant {
  margin-right: 20px;
}

.server-ai-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
}

.server-ai-message-meta small {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
}

.server-ai-message-meta small[data-severity="warning"] {
  background: var(--warning-muted);
  color: var(--warning);
}

.server-ai-message-meta small[data-severity="critical"] {
  background: var(--error-muted);
  color: var(--error);
}

.server-ai-message-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}

.server-ai-questions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warning-muted);
  color: var(--warning);
  font-size: 13px;
}

.server-ai-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.server-ai-action {
  padding: 11px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.server-ai-action-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.server-ai-action-head strong {
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.server-ai-action-head span {
  flex: 0 0 auto;
  max-width: 46%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-ai-action p {
  margin: 0 0 8px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.45;
}

.server-ai-action code {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.server-ai-apply {
  align-self: flex-start;
}

.server-ai-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.server-ai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
  padding-top: 2px;
}

.server-ai-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
  outline: none;
}

.server-ai-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.server-ai-form textarea::placeholder {
  color: var(--text-quaternary);
}

.server-ai-form button {
  width: 44px;
  padding: 0;
}

@media (max-width: 768px) {
  .server-ai-floating {
    right: 14px;
    bottom: 14px;
  }

  .server-ai-window {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 96px);
  }

  .server-ai-subtitle {
    display: none;
  }

  .server-ai-quick-actions {
    grid-template-columns: 1fr;
  }

  .server-ai-messages {
    max-height: calc(100vh - 368px);
    min-height: 220px;
  }

  .server-ai-message-user {
    margin-left: 18px;
  }

  .server-ai-message-assistant {
    margin-right: 12px;
  }

  .server-ai-action-head {
    flex-direction: column;
  }

  .server-ai-action-head span {
    max-width: 100%;
  }

  .server-ai-launcher {
    width: 54px;
    height: 54px;
  }
}
