<template>
  <div class="header-container">
    <!-- 左侧Logo -->
    <div class="header-left">
      <img 
        src="/src/assets/states/yclogo.png" 
        alt="暖洋葱家庭教育" 
        class="logo"
        @error="handleImageError"
      />
    </div>

    <!-- 右侧用户信息 -->
    <div class="header-ringht" style="display: flex; align-items: center; gap: 10px;">
      <img
        src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
        alt="用户头像"
        class="avatar"
        @error="handleAvatarError"
        style="width: 35px; height: 35px;"
      />
      <span>你好，管理员</span>
    </div>
  </div>
</template>

<script>

</script>

<style scoped>
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 45vw;
  height: 60px;
  padding: 0 20px;
  background: #ffffff;
  border-bottom: 1px solid #e4e7ed;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
  margin-bottom: 10px;
}

.header-left {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.8;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.avatar-container {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f5f7fa;
}

.avatar-container:hover {
  background: #e4e7ed;
  transform: translateY(-1px);
}

.el-avatar {
  margin-right: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
  display: flex;
  flex-direction: column;
  margin-right: 5px;
}

.status-indicator {
  display: flex;
  align-items: center;
  font-size: 11px;
  color: #67c23a;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #67c23a;
  margin-right: 3px;
  display: inline-block;
}

.username {
  font-size: 13px;
  font-weight: 500;
  color: #303133;
  margin-right: 4px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-icon {
  font-size: 11px;
  color: #909399;
  transition: transform 0.3s ease;
  margin-left: 2px;
}

.avatar-container:hover .dropdown-icon {
  transform: rotate(180deg);
}

/* 下拉菜单样式 */
:deep(.el-dropdown-menu) {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e4e7ed;
  padding: 8px 0;
}

:deep(.el-dropdown-menu__item) {
  padding: 10px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

:deep(.el-dropdown-menu__item:hover) {
  background: #f5f7fa;
  color: #409eff;
}

:deep(.el-dropdown-menu__item.is-divided) {
  border-top: 1px solid #e4e7ed;
  margin-top: 4px;
  padding-top: 12px;
}

:deep(.el-dropdown-menu__item .el-icon) {
  font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-container {
    padding: 0 15px;
  }
  
  .logo {
    height: 35px;
    max-width: 150px;
  }
  
  .username {
    display: none;
  }
  
  .user-avatar-container {
    padding: 6px 8px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 10px;
  }
  
  .logo {
    height: 30px;
    max-width: 120px;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  .header-container {
    background: #1f2937;
    border-bottom-color: #374151;
  }
  
  .user-avatar-container {
    background: #374151;
  }
  
  .user-avatar-container:hover {
    background: #4b5563;
  }
  
  .username {
    color: #f9fafb;
  }
  
  .dropdown-icon {
    color: #9ca3af;
  }
}
</style>