<template>
  <div class="splash-screen">
    <div class="splash-content">
      <div class="splash-logo">Fischer AgentKit</div>
      <div class="splash-subtitle">AI 智能体框架</div>
      <div v-if="!error" class="splash-progress">
        <div class="splash-progress-bar">
          <div class="splash-progress-inner"></div>
        </div>
      </div>
      <div v-if="!error" class="splash-status">{{ status }}</div>
      <div v-if="error" class="splash-error">
        <div class="splash-error-text">{{ error }}</div>
        <button v-if="onRetry" class="splash-retry" @click="onRetry">重试</button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps<{
  status: string
  error?: string
  onRetry?: () => void | Promise<void>
}>()
</script>

<style scoped>
.splash-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #fbfbfa);
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.splash-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 8px;
}
.splash-subtitle {
  font-size: 13px;
  color: var(--text-tertiary, #888);
  margin-bottom: 32px;
}
.splash-progress {
  width: 200px;
}
.splash-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border-color, #ededec);
  border-radius: 2px;
  overflow: hidden;
}
.splash-progress-inner {
  width: 40%;
  height: 100%;
  background: var(--color-primary, #6366f1);
  border-radius: 2px;
  animation: splash-loading 1.5s ease-in-out infinite;
}
@keyframes splash-loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.splash-status {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-quaternary, #aaa);
}
.splash-error {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.splash-error-text {
  font-size: 12px;
  color: var(--color-error, #ff4d4f);
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}
.splash-retry {
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-inverse, #ffffff);
  background: var(--color-primary, #6366f1);
  border: 1px solid var(--color-primary, #6366f1);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.splash-retry:hover {
  opacity: 0.85;
}
.splash-retry:active {
  transform: scale(0.97);
}
</style>
