<template>
  <div class="error-page">
    <div class="page-header">
      <h1 class="title">出现错误</h1>
    </div>

    <div class="error-container">
      <div class="icon-wrapper">
        <svg class="error-svg" viewBox="0 0 24 24" width="80" height="80">
          <circle cx="12" cy="12" r="11" fill="#f44336" opacity="0.1"/>
          <path fill="#f44336" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
        </svg>
      </div>
      <h2 class="error-title">{{ errorTitle }}</h2>
      <p class="error-message">{{ errorMessage }}</p>
      <button @click="$emit('retry')" class="retry-btn">重新尝试</button>
    </div>

    <div class="notice-text">
      <p>遇到问题？请联系客服</p>
      <p>我们会尽快为您解决</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ErrorPage',
  props: {
    errorTitle: {
      type: String,
      required: true
    },
    errorMessage: {
      type: String,
      required: true
    }
  },
  emits: ['retry']
}
</script>

<style scoped>
.error-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  min-height: 100vh;
}

.page-header {
  text-align: center;
  padding: 20px;
  background: white;
  border-bottom: 3px solid #f44336;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #333;
  background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.icon-wrapper {
  margin-bottom: 24px;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-svg {
  filter: drop-shadow(0 4px 8px rgba(244, 67, 54, 0.3));
}

.error-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: #333;
}

.error-message {
  font-size: 14px;
  color: #666;
  margin: 0 0 32px 0;
  line-height: 1.6;
  max-width: 320px;
}

.retry-btn {
  background: linear-gradient(135deg, #4776e6 0%, #8e54e9 100%);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.retry-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.notice-text {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-top: 2px solid #e9ecef;
  margin-top: auto;
}

.notice-text p {
  margin: 4px 0;
  font-size: 12px;
  color: #666;
}

@media (max-width: 768px) {
  .error-svg {
    width: 64px;
    height: 64px;
  }

  .error-title {
    font-size: 18px;
  }
}
</style>